* 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 );
}
}
+ /**
+ * 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
*