Do not insert page titles into querycache.qc_value
[lhc/web/wiklou.git] / tests / phpunit / PHPUnit4And6Compat.php
index 672ab4a..1ef0c91 100644 (file)
@@ -29,9 +29,9 @@ trait PHPUnit4And6Compat {
         * is a temporary backwards-compatibility layer while we transition.
         */
        public function setExpectedException( $name, $message = '', $code = null ) {
-               if ( is_callable( [ $this, 'expectException' ] ) ) {
+               if ( is_callable( 'parent::expectException' ) ) {
                        if ( $name !== null ) {
-                               $this->expectException( $name );
+                               parent::expectException( $name );
                        }
                        if ( $message !== '' ) {
                                $this->expectExceptionMessage( $message );
@@ -44,6 +44,18 @@ trait PHPUnit4And6Compat {
                }
        }
 
+       /**
+        * Future-compatible layer for PHPUnit 4's setExpectedException.
+        */
+       public function expectException( $exception ) {
+               if ( is_callable( 'parent::expectException' ) ) {
+                       parent::expectException( $exception );
+                       return;
+               }
+
+               parent::setExpectedException( $exception );
+       }
+
        /**
         * @see PHPUnit_Framework_TestCase::getMock
         *
@@ -118,4 +130,18 @@ trait PHPUnit4And6Compat {
                        // ->disallowMockingUnknownTypes()
                        ->getMock();
        }
+
+       /**
+        * Marks the current test as risky. This
+        * is a forward port of the markAsRisky function that
+        * was introduced in PHPUnit 5.7.6.
+        */
+       public function markAsRisky() {
+               if ( is_callable( 'parent::markAsRisky' ) ) {
+                       return parent::markAsRisky();
+               }
+
+               // "risky" tests are not supported in phpunit 4, so just ignore
+       }
+
 }