summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/Hooks/UserHooksTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/tests/Hooks/UserHooksTest.php')
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index b14a1f6a559..2295b90625d 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -41,6 +41,7 @@ use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
/**
@@ -80,6 +81,10 @@ class UserHooksTest extends TestCase {
*/
private $userSessionMock;
/**
+ * @var MockObject|IUser
+ */
+ private $user;
+ /**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $cryptMock;
@@ -343,24 +348,15 @@ class UserHooksTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->userSessionMock = $this->getMockBuilder(IUserSession::class)
- ->disableOriginalConstructor()
- ->setMethods([
- 'isLoggedIn',
- 'getUID',
- 'login',
- 'logout',
- 'setUser',
- 'getUser',
- 'canChangePassword'
- ])
- ->getMock();
-
- $this->userSessionMock->expects($this->any())->method('getUID')->will($this->returnValue('testUser'));
+ $this->user = $this->createMock(IUser::class);
+ $this->user->expects($this->any())
+ ->method('getUID')
+ ->willReturn('testUser');
+ $this->userSessionMock = $this->createMock(IUserSession::class);
$this->userSessionMock->expects($this->any())
- ->method($this->anything())
- ->will($this->returnSelf());
+ ->method('getUser')
+ ->willReturn($this->user);
$utilMock = $this->getMockBuilder(Util::class)
->disableOriginalConstructor()