You are here

public function HtmlTest::testHtmlGetId in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testHtmlGetId()
  2. 9 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testHtmlGetId()

Tests the Html::getUniqueId() method.

@dataProvider providerTestHtmlGetId

@covers ::getId

Parameters

string $expected: The expected result.

string $source: The string being transformed to an ID.

File

core/tests/Drupal/Tests/Component/Utility/HtmlTest.php, line 203

Class

HtmlTest
Tests \Drupal\Component\Utility\Html.

Namespace

Drupal\Tests\Component\Utility

Code

public function testHtmlGetId($expected, $source) {
  Html::setIsAjax(FALSE);
  $this
    ->assertSame($expected, Html::getId($source));
}