diff --git a/src/HttpBaseTest.php b/src/HttpBaseTest.php index 79fb058..44a7f7d 100644 --- a/src/HttpBaseTest.php +++ b/src/HttpBaseTest.php @@ -10,6 +10,8 @@ abstract class HttpBaseTest extends TestCase { + use PhpUnitBackwardCompatibleTrait; + /** * @var string */ @@ -221,7 +223,7 @@ protected function assertResponse(ResponseInterface $response, array $options = if (null === $options['body']) { $this->assertEmpty($response->getBody()->__toString()); } else { - $this->assertContains($options['body'], $response->getBody()->__toString()); + $this->assertStringContainsString($options['body'], $response->getBody()->__toString()); } } diff --git a/src/HttpClientTest.php b/src/HttpClientTest.php index 5c82aa6..aaaf7a4 100644 --- a/src/HttpClientTest.php +++ b/src/HttpClientTest.php @@ -3,6 +3,7 @@ namespace Http\Client\Tests; use Psr\Http\Client\ClientInterface; +use Psr\Http\Client\NetworkExceptionInterface; /** * @author GeLo @@ -92,8 +93,7 @@ public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, arr } /** - * @expectedException \Psr\Http\Client\NetworkExceptionInterface - * @group integration + * @group integration */ public function testSendWithInvalidUri() { @@ -103,6 +103,7 @@ public function testSendWithInvalidUri() $this->defaultHeaders ); + $this->expectException(NetworkExceptionInterface::class); $this->httpAdapter->sendRequest($request); } } diff --git a/src/HttpFeatureTest.php b/src/HttpFeatureTest.php index 08f7ced..fd4836f 100644 --- a/src/HttpFeatureTest.php +++ b/src/HttpFeatureTest.php @@ -9,6 +9,8 @@ abstract class HttpFeatureTest extends TestCase { + use PhpUnitBackwardCompatibleTrait; + /** * @var MessageFactory */ @@ -141,7 +143,7 @@ public function testEncoding() $response = $this->createClient()->sendRequest($request); $this->assertSame(200, $response->getStatusCode()); - $this->assertContains('€', $response->getBody()->__toString()); + $this->assertStringContainsString('€', $response->getBody()->__toString()); } /** @@ -157,7 +159,7 @@ public function testGzip() $response = $this->createClient()->sendRequest($request); $this->assertSame(200, $response->getStatusCode()); - $this->assertContains('gzip', $response->getBody()->__toString()); + $this->assertStringContainsString('gzip', $response->getBody()->__toString()); } /** @@ -173,7 +175,7 @@ public function testDeflate() $response = $this->createClient()->sendRequest($request); $this->assertSame(200, $response->getStatusCode()); - $this->assertContains('deflate', $response->getBody()->__toString()); + $this->assertStringContainsString('deflate', $response->getBody()->__toString()); } /** diff --git a/src/PhpUnitBackwardCompatibleTrait.php b/src/PhpUnitBackwardCompatibleTrait.php new file mode 100644 index 0000000..05f094d --- /dev/null +++ b/src/PhpUnitBackwardCompatibleTrait.php @@ -0,0 +1,18 @@ +