Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karser committed Apr 28, 2024
1 parent d97138a commit 9c3adb3
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions Tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ public function testFormJavascriptPresent_ifEnabled()
$view = $template->render(['form' => $form->createView()]);

//THEN
if (TestKernel::VERSION_ID >= 60400) {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]">', $view);
} else {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]" />', $view);
}
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]"', $view);
self::assertStringContainsString('<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=key&hl=en&onload=recaptchaCallback_form_captcha" async defer nonce=""></script>', $view);
self::assertStringContainsString('var recaptchaCallback_form_captcha', $view);
self::assertStringContainsString("document.getElementById('form_captcha').value = token;", $view);
Expand All @@ -59,11 +55,7 @@ public function testHyphenConvertedToUnderscore()
$view = $template->render(['form' => $form->createView()]);

//THEN
if (TestKernel::VERSION_ID >= 60400) {
self::assertStringContainsString('<input type="hidden" id="form_capt-cha" name="form[capt-cha]">', $view);
} else {
self::assertStringContainsString('<input type="hidden" id="form_capt-cha" name="form[capt-cha]" />', $view);
}
self::assertStringContainsString('<input type="hidden" id="form_capt-cha" name="form[capt-cha]"', $view);
self::assertStringContainsString('<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=key&hl=en&onload=recaptchaCallback_form_capt_cha" async defer nonce=""></script>', $view);
self::assertStringContainsString('var recaptchaCallback_form_capt_cha', $view);
self::assertStringContainsString("document.getElementById('form_capt-cha').value = token;", $view);
Expand All @@ -80,11 +72,7 @@ public function testFormJavascriptAbsent_ifDisabled()
$view = $template->render(['form' => $form->createView()]);

//THEN
if (TestKernel::VERSION_ID >= 60400) {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]">', $view);
} else {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]" />', $view);
}
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]"', $view);
self::assertStringNotContainsString('<script src="https://www.google.com/recaptcha/api.js?render=key"></script>', $view);
self::assertStringNotContainsString("document.getElementById('form_captcha').value = token;", $view);
}
Expand Down Expand Up @@ -205,11 +193,7 @@ public function testFormJavascriptNoncePresent_ifSet()
$view = $template->render(['form' => $form->createView()]);

//THEN
if (TestKernel::VERSION_ID >= 60400) {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]">', $view);
} else {
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]" />', $view);
}
self::assertStringContainsString('<input type="hidden" id="form_captcha" name="form[captcha]"', $view);
self::assertStringContainsString('<script type="text/javascript" nonce="csp_nonce">', $view);
self::assertStringContainsString('<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=key&hl=en&onload=recaptchaCallback_form_captcha" async defer nonce="csp_nonce"></script>', $view);
self::assertStringContainsString('var recaptchaCallback_form_captcha', $view);
Expand Down

0 comments on commit 9c3adb3

Please sign in to comment.