public function SafeMarkupTest::providerCheckPlain in Drupal 8
Data provider for testCheckPlain() and testHtmlEscapedText().
See also
testCheckPlain()
testHtmlEscapedText()
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ SafeMarkupTest.php, line 94 - Contains \Drupal\Tests\Component\Utility\SafeMarkupTest.
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�barbaz',
'Escapes invalid sequence "Foo\\xC0barbaz"',
];
$tests[] = [
"",
'�"',
'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;
}