diff options
Diffstat (limited to 'apps/encryption/tests/hooks/UserHooksTest.php')
-rw-r--r-- | apps/encryption/tests/hooks/UserHooksTest.php | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/apps/encryption/tests/hooks/UserHooksTest.php b/apps/encryption/tests/hooks/UserHooksTest.php index 08d1981266c..1aeafad0ba2 100644 --- a/apps/encryption/tests/hooks/UserHooksTest.php +++ b/apps/encryption/tests/hooks/UserHooksTest.php @@ -71,7 +71,7 @@ class UserHooksTest extends TestCase { private $params = ['uid' => 'testUser', 'password' => 'password']; public function testLogin() { - $this->userSetupMock->expects($this->exactly(2)) + $this->userSetupMock->expects($this->once()) ->method('setupUser') ->willReturnOnConsecutiveCalls(true, false); @@ -80,7 +80,6 @@ class UserHooksTest extends TestCase { ->with('testUser', 'password'); $this->assertNull($this->instance->login($this->params)); - $this->assertFalse($this->instance->login($this->params)); } public function testLogout() { @@ -256,7 +255,7 @@ class UserHooksTest extends TestCase { ->with('testUser'); $this->userSetupMock->expects($this->once()) - ->method('setupServerSide') + ->method('setupUser') ->with('testUser', 'password'); $this->assertNull($this->instance->postPasswordReset($this->params)); @@ -312,16 +311,22 @@ class UserHooksTest extends TestCase { $this->sessionMock = $sessionMock; $this->recoveryMock = $recoveryMock; $this->utilMock = $utilMock; - $this->instance = new UserHooks($this->keyManagerMock, - $this->userManagerMock, - $this->loggerMock, - $this->userSetupMock, - $this->userSessionMock, - $this->utilMock, - $this->sessionMock, - $this->cryptMock, - $this->recoveryMock - ); + $this->utilMock->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); + + $this->instance = $this->getMockBuilder('OCA\Encryption\Hooks\UserHooks') + ->setConstructorArgs( + [ + $this->keyManagerMock, + $this->userManagerMock, + $this->loggerMock, + $this->userSetupMock, + $this->userSessionMock, + $this->utilMock, + $this->sessionMock, + $this->cryptMock, + $this->recoveryMock + ] + )->setMethods(['setupFS'])->getMock(); } |