MDL-71036 phpunit: XML load() method has been moved to new loader class

Used by our custom assertTag() and assertNotTag() assertions, that some
day we should deprecate... the loading of XML content for further
processing has been moved to new classes within the PHPUnit utils. We
are just following the move here.
This commit is contained in:
Eloy Lafuente (stronk7) 2021-02-20 15:48:03 +01:00
parent 857f6385a4
commit 8a3663b175

View File

@ -53,7 +53,7 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase {
* @deprecated 3.0
*/
public static function assertTag($matcher, $actual, $message = '', $ishtml = true) {
$dom = PHPUnit\Util\XML::load($actual, $ishtml);
$dom = (new PHPUnit\Util\Xml\Loader)->load($actual, $ishtml);
$tags = self::findNodes($dom, $matcher, $ishtml);
$matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
self::assertTrue($matched, $message);
@ -71,7 +71,7 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase {
* @deprecated 3.0
*/
public static function assertNotTag($matcher, $actual, $message = '', $ishtml = true) {
$dom = PHPUnit\Util\XML::load($actual, $ishtml);
$dom = (new PHPUnit\Util\Xml\Loader)->load($actual, $ishtml);
$tags = self::findNodes($dom, $matcher, $ishtml);
$matched = (is_array($tags) && count($tags) > 0) && $tags[0] instanceof DOMNode;
self::assertFalse($matched, $message);