protected function XssTest::assertNormalized

Asserts that a text transformed to lowercase with HTML entities decoded does contains a given string.

Otherwise fails the test with a given message, similar to all the SimpleTest assert* functions.

Note that this does not remove nulls, new lines and other characters that could be used to obscure a tag or an attribute name.

Parameters

string $haystack: Text to look in.

string $needle: Lowercase, plain text to look for.

string $message: (optional) Message to display if failed. Defaults to an empty string.

string $group: (optional) The group this message belongs to. Defaults to 'Other'.

1 call to XssTest::assertNormalized()
XssTest::testFilterXssNormalized in drupal/core/tests/Drupal/Tests/Component/Utility/XssTest.php
Tests limiting allowed tags and XSS prevention.

File

drupal/core/tests/Drupal/Tests/Component/Utility/XssTest.php, line 541
Contains \Drupal\Tests\Component\Utility\XssTest.

Class

XssTest
Tests the Xss utility.

Namespace

Drupal\Tests\Component\Utility

Code

protected function assertNormalized($haystack, $needle, $message = '', $group = 'Other') {
  $this
    ->assertTrue(strpos(strtolower(String::decodeEntities($haystack)), $needle) !== FALSE, $message, $group);
}