diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 933859571b..59ea4635fd 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -564,23 +564,25 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { } /** - * PHPUnit 6+ compatibility shim. + * Redundant PHPUnit 6+ compatibility shim. DO NOT USE! + * + * This method is only left in place for backward compatibility reasons. + * + * @deprecated 5.9.0 Use the PHPUnit native expectException*() methods directly. * * @param mixed $exception * @param string $message * @param int|string $code */ public function setExpectedException( $exception, $message = '', $code = null ) { - if ( method_exists( 'PHPUnit_Framework_TestCase', 'setExpectedException' ) ) { - parent::setExpectedException( $exception, $message, $code ); - } else { - $this->expectException( $exception ); - if ( '' !== $message ) { - $this->expectExceptionMessage( $message ); - } - if ( null !== $code ) { - $this->expectExceptionCode( $code ); - } + $this->expectException( $exception ); + + if ( '' !== $message ) { + $this->expectExceptionMessage( $message ); + } + + if ( null !== $code ) { + $this->expectExceptionCode( $code ); } }