File tree Expand file tree Collapse file tree
src/Authentication/TwoFactorAuth/Service
tests/Unit/Authentication/TwoFactorAuth/Service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public function loginUser(string $userId): void
4949 $ this ->session ->remove (self ::USER_SESSION_KEY );
5050
5151 $ this ->loginAdapter ->loginUser ($ userId );
52+ $ this ->twoFAService ->invalidateChallenge ($ userId );
5253
5354 $ this ->utils ->redirect ($ this ->redirectService ->getRedirectUrl (), false );
5455 }
Original file line number Diff line number Diff line change @@ -83,10 +83,17 @@ public function isChallengeVerifiedProxiesToTwoFAService(): void
8383 #[Test]
8484 public function loginUserLoadsUserLoginsClearsSessionAndRedirects (): void
8585 {
86+ $ userId = uniqid ();
87+
8688 $ loginAdapterSpy = $ this ->createMock (UserLoginAdapterInterface::class);
8789 $ loginAdapterSpy ->expects ($ this ->once ())
8890 ->method ('loginUser ' )
89- ->with ($ userId = uniqid ());
91+ ->with ($ userId );
92+
93+ $ twoFAServiceSpy = $ this ->createMock (TwoFAServiceInterface::class);
94+ $ twoFAServiceSpy ->expects ($ this ->once ())
95+ ->method ('invalidateChallenge ' )
96+ ->with ($ userId );
9097
9198 $ sessionSpy = $ this ->createMock (SessionInterface::class);
9299 $ sessionSpy ->expects ($ this ->once ())
@@ -100,6 +107,7 @@ public function loginUserLoadsUserLoginsClearsSessionAndRedirects(): void
100107 $ utilsSpy ->expects ($ this ->once ())->method ('redirect ' )->with ($ redirectUrl , false );
101108
102109 $ sut = $ this ->getSut (
110+ twoFAService: $ twoFAServiceSpy ,
103111 loginAdapter: $ loginAdapterSpy ,
104112 session: $ sessionSpy ,
105113 redirectService: $ redirectServiceStub ,
You can’t perform that action at this time.
0 commit comments