From cdca9151c9639ef0eb84454b78479feb177a9cc7 Mon Sep 17 00:00:00 2001 From: Stephen Edgar Date: Tue, 12 Dec 2017 15:33:32 +1100 Subject: [PATCH] Add `setExpectedException::RequestsTest_Transport_Base` --- tests/Transport/Base.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Transport/Base.php b/tests/Transport/Base.php index 5ddce18c1..566e09fad 100644 --- a/tests/Transport/Base.php +++ b/tests/Transport/Base.php @@ -17,6 +17,28 @@ public function setUp() { } protected $skip_https = false; + /** + * PHPUnit 6+ compatibility shim. + * + * @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 ); + } + } + } + + protected function getOptions($other = array()) { $options = array( 'transport' => $this->transport