phpunit: Remove unused assertNotTag() and assertTag() overrides
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 31 Mar 2017 23:32:24 +0000 (16:32 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 1 Apr 2017 00:30:38 +0000 (17:30 -0700)
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 23ec64745cdba0522f70, 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

tests/phpunit/MediaWikiTestCase.php

index 419ff00..bb7267a 100644 (file)
@@ -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