diff options
author | Joas Schilling <coding@schilljs.com> | 2023-06-30 14:14:36 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-03 14:25:01 +0200 |
commit | 05aa39d777039c07de4e10b1b2aae8223e2b63df (patch) | |
tree | da29654da60513d8bf1720c5ddea72de7905a706 /tests/lib/Authentication/TwoFactorAuth | |
parent | 1d5beb368862020b49fe1cc840e9b1c7eb3f6931 (diff) | |
download | nextcloud-server-05aa39d777039c07de4e10b1b2aae8223e2b63df.tar.gz nextcloud-server-05aa39d777039c07de4e10b1b2aae8223e2b63df.zip |
Fix event names of 2FA related typed events
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth')
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/RegistryTest.php | 22 |
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); } |