From 05aa39d777039c07de4e10b1b2aae8223e2b63df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 30 Jun 2023 14:14:36 +0200 Subject: Fix event names of 2FA related typed events Signed-off-by: Joas Schilling --- .../Authentication/TwoFactorAuth/RegistryTest.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'tests/lib/Authentication') 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); } -- cgit v1.2.3