3131use OCA \User_SAML \UserResolver ;
3232use OCP \AppFramework \Http \RedirectResponse ;
3333use OCP \AppFramework \Http \TemplateResponse ;
34+ use OCP \EventDispatcher \IEventDispatcher ;
3435use OCP \IConfig ;
3536use OCP \IL10N ;
3637use OCP \IRequest ;
@@ -72,6 +73,7 @@ class SAMLControllerTest extends TestCase {
7273 /** @var SAMLController */
7374 private $ samlController ;
7475 private ITrustedDomainHelper |MockObject $ trustedDomainController ;
76+ private IEventDispatcher $ eventDispatcher ;
7577
7678 protected function setUp (): void {
7779 parent ::setUp ();
@@ -89,6 +91,7 @@ protected function setUp(): void {
8991 $ this ->userData = $ this ->createMock (UserData::class);
9092 $ this ->crypto = $ this ->createMock (ICrypto::class);
9193 $ this ->trustedDomainController = $ this ->createMock (ITrustedDomainHelper::class);
94+ $ this ->eventDispatcher = $ this ->createMock (IEventDispatcher::class);
9295
9396 $ this ->l ->expects ($ this ->any ())->method ('t ' )->willReturnCallback (
9497 function ($ param ) {
@@ -336,6 +339,11 @@ public function testLoginWithEnvVariable(array $samlUserData, string $redirect,
336339 ->method ('createUserIfNotExists ' )
337340 ->with ('MyUid ' );
338341
342+ $ this ->eventDispatcher
343+ ->expects ($ this ->once ())
344+ ->method ('dispatchTyped ' )
345+ ->with (new UserLoggedInEvent ($ user , 'MyUid ' , null , false ));
346+
339347 $ expected = new RedirectResponse ($ redirect );
340348 $ result = $ this ->samlController ->login (1 );
341349 $ this ->assertEquals ($ expected , $ result );
0 commit comments