aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/TwoFactorAuth
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth')
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/RegistryTest.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
index b6e0caff427..faddc0bc0c8 100644
--- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
@@ -32,6 +32,9 @@ use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\Authentication\TwoFactorAuth\RegistryEvent;
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderDisabled;
+use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered;
+use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered;
+use OCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
@@ -85,6 +88,12 @@ class RegistryTest extends TestCase {
return $e->getUser() === $user && $e->getProvider() === $provider;
})
);
+ $this->dispatcher->expects($this->once())
+ ->method('dispatchTyped')
+ ->with(new TwoFactorProviderForUserRegistered(
+ $user,
+ $provider,
+ ));
$this->registry->enableProviderFor($provider, $user);
}
@@ -106,6 +115,12 @@ class RegistryTest extends TestCase {
return $e->getUser() === $user && $e->getProvider() === $provider;
})
);
+ $this->dispatcher->expects($this->once())
+ ->method('dispatchTyped')
+ ->with(new TwoFactorProviderForUserUnregistered(
+ $user,
+ $provider,
+ ));
$this->registry->disableProviderFor($provider, $user);
}
@@ -121,9 +136,12 @@ class RegistryTest extends TestCase {
'provider_id' => 'twofactor_u2f',
]
]);
- $this->dispatcher->expects($this->once())
+ $this->dispatcher->expects($this->exactly(2))
->method('dispatchTyped')
- ->with(new TwoFactorProviderDisabled('twofactor_u2f'));
+ ->withConsecutive(
+ [new TwoFactorProviderDisabled('twofactor_u2f')],
+ [new TwoFactorProviderUserDeleted($user, 'twofactor_u2f')],
+ );
$this->registry->deleteUserData($user);
}