By longwave 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:
Previously, PHPunit was unable to directly compare string-like objects that implemented MarkupInterface, so AssertHelperTrait provided a castSafeStrings() method that could be used to convert these objects to string before comparing them. Drupal now provides a comparator class that can automatically convert and compare MarkupInterface objects, so the AssertHelperTrait and castSafeStrings() method have been deprecated; tests can now use assertEquals directly.
For example,
use AssertHelperTrait;
public function testSomething() {
...
$this->assertSame($expected, $this->castSafeStrings($reasons));
}
can now be written as:
public function testSomething() {
...
$this->assertEquals($expected, $reasons);
}
Impacts:
Module developers