By acbramley on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.1.x
Introduced in version:
10.1.5
Issue links:
Description:
Previously there was no API for asserting that a link exists or does note exist based on exactly matching the href of the link.
\Drupal\Tests\WebAssert::linkByHrefExistsExactand \Drupal\Tests\WebAssert::linkByHrefNotExistsExact have been added to match an href exactly.
Examples
Both methods can be used to match a links href exactly.
$this->assertSession()->linkByHrefExistsExact('admin/structure/block');
$this->assertSession()->linkByHrefNotExistsExact('admin/structure/block/list/' . $default_theme);
Impacts:
Module developers
Comments
Be aware of subdirectories
To get this working on GitLab CI, which runs tests in a subdirectory, I used the following: