function WebAssertTest::testPageContainsNoDuplicateId

Same name in this branch
  1. 11.x core/tests/Drupal/Tests/Core/Test/WebAssertTest.php \Drupal\Tests\Core\Test\WebAssertTest::testPageContainsNoDuplicateId()
Same name in other branches
  1. 10 core/tests/Drupal/FunctionalTests/WebAssertTest.php \Drupal\FunctionalTests\WebAssertTest::testPageContainsNoDuplicateId()
  2. 10 core/tests/Drupal/Tests/Core/Test/WebAssertTest.php \Drupal\Tests\Core\Test\WebAssertTest::testPageContainsNoDuplicateId()

Tests pageContainsNoDuplicateId() functionality.

@covers ::pageContainsNoDuplicateId

File

core/tests/Drupal/FunctionalTests/WebAssertTest.php, line 349

Class

WebAssertTest
Tests WebAssert functionality.

Namespace

Drupal\FunctionalTests

Code

public function testPageContainsNoDuplicateId() : void {
    $assert_session = $this->assertSession();
    $this->drupalGet(Url::fromRoute('test_page_test.page_without_duplicate_ids'));
    $assert_session->pageContainsNoDuplicateId();
    $this->drupalGet(Url::fromRoute('test_page_test.page_with_duplicate_ids'));
    $this->expectException(ExpectationException::class);
    $this->expectExceptionMessage('The page contains a duplicate HTML ID "page-element".');
    $assert_session->pageContainsNoDuplicateId();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.