protected function IntegrationTest::assertOnlyEscaped in Search API Saved Searches 8
Asserts that the given string is properly escaped on output.
Will check that the string is present in its escaped form in the current page's output (of the default session) and that it's neither present unescaped nor double-escaped.
Parameters
string $string: The string for which to test proper escaping.
2 calls to IntegrationTest::assertOnlyEscaped()
- IntegrationTest::addNewType in tests/
src/ Functional/ IntegrationTest.php - Adds a new saved search type.
- IntegrationTest::deleteType in tests/
src/ Functional/ IntegrationTest.php - Deletes the "Foobar" saved search type.
File
- tests/
src/ Functional/ IntegrationTest.php, line 595
Class
- IntegrationTest
- Tests overall functionality of the module.
Namespace
Drupal\Tests\search_api_saved_searches\FunctionalCode
protected function assertOnlyEscaped(string $string) {
$assert_session = $this
->assertSession();
$escaped = Html::escape($string);
$double_escaped = Html::escape($escaped);
$assert_session
->responseContains($escaped);
if ($string !== $escaped) {
$assert_session
->responseNotContains($string);
}
if ($double_escaped !== $escaped) {
$assert_session
->responseNotContains($double_escaped);
}
}