X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FHtmlTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FHtmlTest.php;h=1860e041050b337beb1bc81d46db38652aeea965;hp=46283421373f8e6d97ec5cf8a5217e862b6ff10e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/web/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php index 462834213..1860e0410 100644 --- a/web/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php +++ b/web/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php @@ -5,7 +5,8 @@ namespace Drupal\Tests\Component\Utility; use Drupal\Component\Render\MarkupInterface; use Drupal\Component\Render\MarkupTrait; use Drupal\Component\Utility\Html; -use Drupal\Tests\UnitTestCase; +use Drupal\Component\Utility\Random; +use PHPUnit\Framework\TestCase; /** * Tests \Drupal\Component\Utility\Html. @@ -14,7 +15,7 @@ use Drupal\Tests\UnitTestCase; * * @coversDefaultClass \Drupal\Component\Utility\Html */ -class HtmlTest extends UnitTestCase { +class HtmlTest extends TestCase { /** * {@inheritdoc} @@ -66,9 +67,10 @@ class HtmlTest extends UnitTestCase { [$id1, $id1, []], // Verify that valid UTF-8 characters are not stripped from the identifier. [$id2, $id2, []], - // Verify that invalid characters (including non-breaking space) are stripped from the identifier. - [$id3, $id3], // 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. ['invalididentifier', 'invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', []], // Verify that an identifier starting with a digit is replaced. ['_cssidentifier', '1cssidentifier', []], @@ -354,11 +356,14 @@ class HtmlTest extends UnitTestCase { public function providerTestTransformRootRelativeUrlsToAbsolute() { $data = []; + // Random generator. + $random = new Random(); + // One random tag name. - $tag_name = strtolower($this->randomMachineName()); + $tag_name = strtolower($random->name(8, TRUE)); // A site installed either in the root of a domain or a subdirectory. - $base_paths = ['/', '/subdir/' . $this->randomMachineName() . '/']; + $base_paths = ['/', '/subdir/' . $random->name(8, TRUE) . '/']; foreach ($base_paths as $base_path) { // The only attribute that has more than just a URL as its value, is