summaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth/ManagerTest.php')
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index 34ce340049a..1d7c147d9ce 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -160,6 +160,32 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->isTwoFactorAuthenticated($this->user));
}
+ public function testIsTwoFactorAuthenticatedOnlyBackupCodes() {
+ $this->user->expects($this->once())
+ ->method('getUID')
+ ->will($this->returnValue('user123'));
+ $this->config->expects($this->once())
+ ->method('getUserValue')
+ ->with('user123', 'core', 'two_factor_auth_disabled', 0)
+ ->willReturn(0);
+ $this->providerRegistry->expects($this->once())
+ ->method('getProviderStates')
+ ->willReturn([
+ 'backup_codes' => true,
+ ]);
+ $backupCodesProvider = $this->createMock(IProvider::class);
+ $backupCodesProvider
+ ->method('getId')
+ ->willReturn('backup_codes');
+ $this->providerLoader->expects($this->once())
+ ->method('getProviders')
+ ->willReturn([
+ $backupCodesProvider,
+ ]);
+
+ $this->assertFalse($this->manager->isTwoFactorAuthenticated($this->user));
+ }
+
public function testIsTwoFactorAuthenticatedFailingProviders() {
$this->user->expects($this->once())
->method('getUID')