|
|
|
|
@ -387,10 +387,14 @@ 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)) |
|
|
|
|
->method('exists') |
|
|
|
|
->with('two_factor_auth_uid') |
|
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
$this->session->expects($this->at(1)) |
|
|
|
|
$this->session->expects($this->at(2)) |
|
|
|
|
->method('exists') |
|
|
|
|
->with(Manager::SESSION_UID_DONE) |
|
|
|
|
->willReturn(false); |
|
|
|
|
@ -523,6 +527,8 @@ class ManagerTest extends TestCase { |
|
|
|
|
->will($this->returnCallback(function($var) { |
|
|
|
|
if ($var === Manager::SESSION_UID_KEY) { |
|
|
|
|
return false; |
|
|
|
|
} else if ($var === 'app_password') { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
})); |
|
|
|
|
@ -585,4 +591,13 @@ class ManagerTest extends TestCase { |
|
|
|
|
|
|
|
|
|
$this->assertFalse($this->manager->needsSecondFactor($user)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testNeedsSecondFactorAppPassword() { |
|
|
|
|
$user = $this->createMock(IUser::class); |
|
|
|
|
$this->session->method('exists') |
|
|
|
|
->with('app_password') |
|
|
|
|
->willReturn(true); |
|
|
|
|
|
|
|
|
|
$this->assertFalse($this->manager->needsSecondFactor($user)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|