function HtmlTest::providerTestCleanCssIdentifier
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::providerTestCleanCssIdentifier()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::providerTestCleanCssIdentifier()
- 10 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::providerTestCleanCssIdentifier()
Provides test data for testCleanCssIdentifier().
Return value
array Test data.
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ HtmlTest.php, line 64
Class
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestCleanCssIdentifier() {
$id1 = 'abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789';
$id2 = '¡¢£¤¥';
$id3 = 'css__identifier__with__double__underscores';
return [
// Verify that no valid ASCII characters are stripped from the identifier.
[
$id1,
$id1,
[],
],
// Verify that valid UTF-8 characters are not stripped from the identifier.
[
$id2,
$id2,
[],
],
// Verify that double underscores are not stripped from the identifier.
[
$id3,
$id3,
],
// Verify that invalid characters (including non-breaking space) are
// stripped from the identifier.
[
'invalid_identifier',
'invalid_ !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier',
[],
],
// Verify that an identifier starting with a digit is replaced.
[
'_css_identifier',
'1css_identifier',
[],
],
// Verify that an identifier starting with a hyphen followed by a digit is
// replaced.
[
'__css_identifier',
'-1css_identifier',
[],
],
// Verify that an identifier starting with two hyphens is replaced.
[
'__css_identifier',
'--css_identifier',
[],
],
// Verify that passing double underscores as a filter is processed.
[
'_css_identifier',
'__css_identifier',
[
'__' => '_',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.