@@ -405,6 +405,55 @@ public function form_csrfTokenGeneratorInstanceOfCsrfTokenManagerInterface_isCsr
405405 */
406406 public function form_renderForm_renderTemplateWithTemplateVars (): void
407407 {
408+ $ this ->firewallConfig
409+ ->expects ($ this ->any ())
410+ ->method ('getCheckPath ' )
411+ ->willReturn ('/2fa_check ' );
412+
413+ $ this ->stubTokenStorageHasTwoFactorToken ();
414+
415+ $ this ->assertTemplateVars (function (array $ templateVars ) {
416+ $ this ->assertArrayHasKey ('twoFactorProvider ' , $ templateVars );
417+ $ this ->assertArrayHasKey ('availableTwoFactorProviders ' , $ templateVars );
418+ $ this ->assertArrayHasKey ('authenticationError ' , $ templateVars );
419+ $ this ->assertArrayHasKey ('authenticationErrorData ' , $ templateVars );
420+ $ this ->assertArrayHasKey ('displayTrustedOption ' , $ templateVars );
421+ $ this ->assertArrayHasKey ('authCodeParameterName ' , $ templateVars );
422+ $ this ->assertArrayHasKey ('trustedParameterName ' , $ templateVars );
423+ $ this ->assertArrayHasKey ('isCsrfProtectionEnabled ' , $ templateVars );
424+ $ this ->assertArrayHasKey ('csrfParameterName ' , $ templateVars );
425+ $ this ->assertArrayHasKey ('csrfTokenId ' , $ templateVars );
426+ $ this ->assertArrayHasKey ('checkPathRoute ' , $ templateVars );
427+ $ this ->assertArrayHasKey ('checkPathUrl ' , $ templateVars );
428+ $ this ->assertArrayHasKey ('logoutPath ' , $ templateVars );
429+
430+ $ this ->assertEquals (self ::CURRENT_TWO_FACTOR_PROVIDER , $ templateVars ['twoFactorProvider ' ]);
431+ $ this ->assertEquals (['provider1 ' , 'provider2 ' ], $ templateVars ['availableTwoFactorProviders ' ]);
432+ $ this ->assertEquals (self ::AUTH_CODE_PARAM_NAME , $ templateVars ['authCodeParameterName ' ]);
433+ $ this ->assertEquals (self ::TRUSTED_PARAM_NAME , $ templateVars ['trustedParameterName ' ]);
434+ $ this ->assertFalse ($ templateVars ['isCsrfProtectionEnabled ' ]);
435+ $ this ->assertEquals (self ::CSRF_PARAMETER , $ templateVars ['csrfParameterName ' ]);
436+ $ this ->assertEquals (self ::CSRF_TOKEN_ID , $ templateVars ['csrfTokenId ' ]);
437+ $ this ->assertEquals (self ::LOGOUT_PATH , $ templateVars ['logoutPath ' ]);
438+ $ this ->assertEquals ('/2fa_check ' , $ templateVars ['checkPathUrl ' ]);
439+ $ this ->assertNull ($ templateVars ['checkPathRoute ' ]);
440+
441+ return true ;
442+ });
443+
444+ $ this ->controller ->form ($ this ->request );
445+ }
446+
447+ /**
448+ * @test
449+ */
450+ public function form_renderForm_renderTemplateWithTemplateVarsSetsRoutePath (): void
451+ {
452+ $ this ->firewallConfig
453+ ->expects ($ this ->any ())
454+ ->method ('getCheckPath ' )
455+ ->willReturn ('admin_2fa_check ' );
456+
408457 $ this ->stubTokenStorageHasTwoFactorToken ();
409458
410459 $ this ->assertTemplateVars (function (array $ templateVars ) {
@@ -418,6 +467,8 @@ public function form_renderForm_renderTemplateWithTemplateVars(): void
418467 $ this ->assertArrayHasKey ('isCsrfProtectionEnabled ' , $ templateVars );
419468 $ this ->assertArrayHasKey ('csrfParameterName ' , $ templateVars );
420469 $ this ->assertArrayHasKey ('csrfTokenId ' , $ templateVars );
470+ $ this ->assertArrayHasKey ('checkPathRoute ' , $ templateVars );
471+ $ this ->assertArrayHasKey ('checkPathUrl ' , $ templateVars );
421472 $ this ->assertArrayHasKey ('logoutPath ' , $ templateVars );
422473
423474 $ this ->assertEquals (self ::CURRENT_TWO_FACTOR_PROVIDER , $ templateVars ['twoFactorProvider ' ]);
@@ -428,6 +479,8 @@ public function form_renderForm_renderTemplateWithTemplateVars(): void
428479 $ this ->assertEquals (self ::CSRF_PARAMETER , $ templateVars ['csrfParameterName ' ]);
429480 $ this ->assertEquals (self ::CSRF_TOKEN_ID , $ templateVars ['csrfTokenId ' ]);
430481 $ this ->assertEquals (self ::LOGOUT_PATH , $ templateVars ['logoutPath ' ]);
482+ $ this ->assertEquals ('admin_2fa_check ' , $ templateVars ['checkPathRoute ' ]);
483+ $ this ->assertNull ($ templateVars ['checkPathUrl ' ]);
431484
432485 return true ;
433486 });
0 commit comments