diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-23 11:00:34 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-23 11:00:34 +0100 |
commit | 343476f54f9d1fab088c3ef17827a49630f591c0 (patch) | |
tree | bf688953404dae6ca0488cca0391fb0491eddb65 /tests/lib/Authentication/TwoFactorAuth | |
parent | a0c7798c7dd0ec537a6ed3b964103a9ad94d2040 (diff) | |
download | nextcloud-server-343476f54f9d1fab088c3ef17827a49630f591c0.tar.gz nextcloud-server-343476f54f9d1fab088c3ef17827a49630f591c0.zip |
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth')
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/ManagerTest.php | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index fc921b8016b..ae6fadc790c 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -376,13 +376,13 @@ class ManagerTest extends TestCase { ->method('get') ->with('two_factor_remember_login') ->willReturn(false); - $this->session->expects($this->at(1)) + $this->session->expects($this->exactly(2)) ->method('remove') - ->with('two_factor_auth_uid'); - $this->session->expects($this->at(2)) - ->method('remove') - ->with('two_factor_remember_login'); - $this->session->expects($this->at(3)) + ->withConsecutive( + ['two_factor_auth_uid'], + ['two_factor_remember_login'] + ); + $this->session->expects($this->once()) ->method('set') ->with(Manager::SESSION_UID_DONE, 'jos'); $this->session->method('getId') @@ -494,17 +494,13 @@ class ManagerTest extends TestCase { public function testNeedsSecondFactor() { $user = $this->createMock(IUser::class); - $this->session->expects($this->at(0)) - ->method('exists') - ->with('app_password') - ->willReturn(false); - $this->session->expects($this->at(1)) + $this->session->expects($this->exactly(3)) ->method('exists') - ->with('two_factor_auth_uid') - ->willReturn(false); - $this->session->expects($this->at(2)) - ->method('exists') - ->with(Manager::SESSION_UID_DONE) + ->withConsecutive( + ['app_password'], + ['two_factor_auth_uid'], + [Manager::SESSION_UID_DONE], + ) ->willReturn(false); $this->session->method('getId') @@ -575,12 +571,12 @@ class ManagerTest extends TestCase { $this->user->method('getUID') ->willReturn('ferdinand'); - $this->session->expects($this->at(0)) - ->method('set') - ->with('two_factor_auth_uid', 'ferdinand'); - $this->session->expects($this->at(1)) + $this->session->expects($this->exactly(2)) ->method('set') - ->with('two_factor_remember_login', true); + ->withConsecutive( + ['two_factor_auth_uid', 'ferdinand'], + ['two_factor_remember_login', true] + ); $this->session->method('getId') ->willReturn('mysessionid'); @@ -605,12 +601,12 @@ class ManagerTest extends TestCase { $this->user->method('getUID') ->willReturn('ferdinand'); - $this->session->expects($this->at(0)) - ->method('set') - ->with('two_factor_auth_uid', 'ferdinand'); - $this->session->expects($this->at(1)) + $this->session->expects($this->exactly(2)) ->method('set') - ->with('two_factor_remember_login', false); + ->withConsecutive( + ['two_factor_auth_uid', 'ferdinand'], + ['two_factor_remember_login', false] + ); $this->session->method('getId') ->willReturn('mysessionid'); |