function SafeMarkupTest::providerCheckPlain in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php \Drupal\Tests\Component\Utility\SafeMarkupTest::providerCheckPlain()
Data provider for testCheckPlain() and testEscapeString().
See also
testCheckPlain()
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ SafeMarkupTest.php, line 104 - Contains \Drupal\Tests\Component\Utility\SafeMarkupTest.
Class
- SafeMarkupTest
- Tests marking strings as safe.
Namespace
Drupal\Tests\Component\UtilityCode
function providerCheckPlain() {
// Checks that invalid multi-byte sequences are escaped.
$tests[] = array(
"",
'Foo�barbaz',
'Escapes invalid sequence "Foo\\xC0barbaz"',
);
$tests[] = array(
"",
'�"',
'Escapes invalid sequence "\\xc2\\""',
);
$tests[] = array(
"Fooÿñ",
"Fooÿñ",
'Does not escape valid sequence "Fooÿñ"',
);
// Checks that special characters are escaped.
$tests[] = array(
SafeMarkupTestMarkup::create("<script>"),
'<script>',
'Escapes <script> even inside an object that implements MarkupInterface.',
);
$tests[] = array(
"<script>",
'<script>',
'Escapes <script>',
);
$tests[] = array(
'<>&"\'',
'<>&"'',
'Escapes reserved HTML characters.',
);
$tests[] = array(
SafeMarkupTestMarkup::create('<>&"\''),
'<>&"'',
'Escapes reserved HTML characters even inside an object that implements MarkupInterface.',
);
return $tests;
}