By mondrake on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
9.1.x
Introduced in version:
9.1.0
Issue links:
Description:
For Functional and FunctionaJavascript tests, a new WebAssert::pageTextMatchesCount has been implemented to assert the number of occurrences of a regex pattern in the response's page text.
This can be used to replace legacy assertNoUniqueText calls when the expected cardinality is known.
For example:
BEFORE:
// Ensure duplicate messages are handled as expected.
$this->assertUniqueText('Non Duplicated message');
$this->assertNoUniqueText('Duplicated message');
AFTER:
// Ensure duplicate messages are handled as expected.
$this->assertSession()->pageTextMatchesCount(1, '/Non Duplicated message/');
$this->assertSession()->pageTextMatchesCount(3, '/Duplicated message/');
Impacts:
Module developers