From: Timo Tijhof Date: Fri, 31 Mar 2017 23:32:24 +0000 (-0700) Subject: phpunit: Remove unused assertNotTag() and assertTag() overrides X-Git-Tag: 1.31.0-rc.0~3640^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=812cfe419af9e964767408a391ba073d91b37fd6;p=lhc%2Fweb%2Fwiklou.git phpunit: Remove unused assertNotTag() and assertTag() overrides Deprecated since PHPUnit 4.2, we use PHPUnit 4.8 and would like to be compatible with PHPUnit 5 which no longer has this method. The current hack was only enough to avoid the deprecation warning, the underlying logic in Xml::findNodes() was also removed in PHPUnit 5. Follows-up 23ec64745c, dba0522f70, T71505. * assertNotTag() is not used anywhere in Wikimedia Git. * assertTag() was used in 1 test in core, fixed in the parent commit. Match in mediawiki/skins/chameleon is unrelated. Change-Id: I56b8f1f88124d69190938fc522ea75419e96c49c --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 419ff00f85..bb7267a612 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1768,51 +1768,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->assertEmpty( $errors, implode( "\n", $errors ) ); } - /** - * @param array $matcher - * @param string $actual - * @param bool $isHtml - * - * @return bool - */ - private static function tagMatch( $matcher, $actual, $isHtml = true ) { - $dom = PHPUnit_Util_XML::load( $actual, $isHtml ); - $tags = PHPUnit_Util_XML::findNodes( $dom, $matcher, $isHtml ); - return count( $tags ) > 0 && $tags[0] instanceof DOMNode; - } - - /** - * Note: we are overriding this method to remove the deprecated error - * @see https://phabricator.wikimedia.org/T71505 - * @see https://github.com/sebastianbergmann/phpunit/issues/1292 - * @deprecated - * - * @param array $matcher - * @param string $actual - * @param string $message - * @param bool $isHtml - */ - public static function assertTag( $matcher, $actual, $message = '', $isHtml = true ) { - // trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED); - - self::assertTrue( self::tagMatch( $matcher, $actual, $isHtml ), $message ); - } - - /** - * @see MediaWikiTestCase::assertTag - * @deprecated - * - * @param array $matcher - * @param string $actual - * @param string $message - * @param bool $isHtml - */ - public static function assertNotTag( $matcher, $actual, $message = '', $isHtml = true ) { - // trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED); - - self::assertFalse( self::tagMatch( $matcher, $actual, $isHtml ), $message ); - } - /** * Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit. * @return string