Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests #72

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading