function SafeMarkupTest::providerCheckPlain
Data provider for testCheckPlain() and testHtmlEscapedText().
See also
testCheckPlain()
testHtmlEscapedText()
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ SafeMarkupTest.php, line 94
Class
- SafeMarkupTest
- Tests marking strings as safe.
Namespace
Drupal\Tests\Component\UtilityCode
public function providerCheckPlain() {
// Checks that invalid multi-byte sequences are escaped.
$tests[] = [
"Foo\xc0barbaz",
'Foo�barbaz',
'Escapes invalid sequence "Foo\\xC0barbaz"',
];
$tests[] = [
"\xc2\"",
'�"',
'Escapes invalid sequence "\\xc2\\""',
];
$tests[] = [
"Fooÿñ",
"Fooÿñ",
'Does not escape valid sequence "Fooÿñ"',
];
// Checks that special characters are escaped.
$tests[] = [
SafeMarkupTestMarkup::create("<script>"),
'<script>',
'Escapes <script> even inside an object that implements MarkupInterface.',
];
$tests[] = [
"<script>",
'<script>',
'Escapes <script>',
];
$tests[] = [
'<>&"\'',
'<>&"'',
'Escapes reserved HTML characters.',
];
$tests[] = [
SafeMarkupTestMarkup::create('<>&"\''),
'<>&"'',
'Escapes reserved HTML characters even inside an object that implements MarkupInterface.',
];
return $tests;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.