public function AttributeTest::providerTestAttributeValues in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::providerTestAttributeValues()
File
- core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php, line 365
Class
- AttributeTest
- @coversDefaultClass \Drupal\Core\Template\Attribute @group Template
Namespace
Drupal\Tests\Core\TemplateCode
public function providerTestAttributeValues() {
$data = [];
$string = '"> <script>alert(123)</script>"';
$data['safe-object-xss1'] = [
[
'title' => Markup::create($string),
],
' title=""> alert(123)""',
];
$data['non-safe-object-xss1'] = [
[
'title' => $string,
],
' title="' . Html::escape($string) . '"',
];
$string = '"><script>alert(123)</script>';
$data['safe-object-xss2'] = [
[
'title' => Markup::create($string),
],
' title="">alert(123)"',
];
$data['non-safe-object-xss2'] = [
[
'title' => $string,
],
' title="' . Html::escape($string) . '"',
];
return $data;
}