X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FPHPUnit4And6Compat.php;h=79ce634fab75ddc3b520cf75196d0f0398250d1c;hb=d7678fa45e949a5a5eaa369b45e48667a6132c07;hp=672ab4a4d650d6c0bf79b6488cd7be27d5564fd3;hpb=5c357bf6c28eb0c3462374e088a6583eecbd2953;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/PHPUnit4And6Compat.php b/tests/phpunit/PHPUnit4And6Compat.php index 672ab4a4d6..79ce634fab 100644 --- a/tests/phpunit/PHPUnit4And6Compat.php +++ b/tests/phpunit/PHPUnit4And6Compat.php @@ -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 *