Add linkByHrefExistsExact and linkByHrefNotExistsExact for matching links by href exactly

Created on 29 June 2013, almost 12 years ago
Updated 1 September 2024, 8 months ago

Problem/Motivation

Currently both \Drupal\Tests\WebAssert::linkByHrefExists and \Drupal\Tests\WebAssert::linkByHrefNotExists check if the link _contains_ the giving $href and don't check if there's an exact match.

This can result in unexpected behavior (tests passing when they shouldn't) and so needs to be worked around, as seen in the following tickets :

#2030129: FilterFormat has no access controller
#2031211: Check for URL's absence will always pass due to wrong var name

Changing the existing functions would be very disruptive to core and contrib (see previous patches for changes that may be required).

We already have linkNotExistsExact and linkExistsExact for exact matching by label, so we should add the same for href matching. This will help some core tests such as the ones being implemented in 🐛 Generic Revision UI's Revision overview page generates wrong operations/view links for a translation Fixed

Proposed resolution


Implement linkByHrefExistsExact and linkByHrefNotExistsExact

Remaining tasks

None

User interface changes

None

API changes

Adds linkByHrefExistsExact and linkByHrefNotExistsExact to WebAssert

Data model changes

None

Release notes snippet

Original IS

This can result in unexpected behavior (tests passing when they shouldn't) and so needs to be worked around, as seen in the following tickets :

#2030129: FilterFormat has no access controller
#2031211: Check for URL's absence will always pass due to wrong var name

Should this be changed? What might it break?

📌 Task
Status

Fixed

Version

10.1

Component
PHPUnit 

Last updated about 12 hours ago

Created by

🇬🇧United Kingdom a_c_m

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024