Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
PHP 7.3 is now officialy supported
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël Andrieu committed Sep 20, 2019
1 parent e575ce1 commit 6820f1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ php:

matrix:
fast_finish: true
allow_failures:
- php: 7.3

cache:
directories:
Expand Down
24 changes: 19 additions & 5 deletions tests/Clients/SymfonyClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Resiliency\Clients\SymfonyClient;
use Tests\Resiliency\CircuitBreakerTestCase;
use Resiliency\Exceptions\UnavailableService;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Component\HttpClient\Response\MockResponse;

class SymfonyClientTest extends CircuitBreakerTestCase
{
Expand Down Expand Up @@ -35,9 +36,10 @@ public function testTheClientAcceptsHttpMethodOverride(): void
'method' => 'HEAD',
]);

$service = $this->getService('https://www.google.fr');
$service = $this->getService('https://www.google.com');

self::assertEmpty(
self::assertSame(
'',
$client->request(
$service,
$this->getPlace()
Expand All @@ -47,13 +49,25 @@ public function testTheClientAcceptsHttpMethodOverride(): void

private function getClient(): HttpClientInterface
{
return HttpClient::create();
$callback = function ($method, $url, $options) {
if ($url === 'http://not-even-a-valid-domain.xxx/') {
return new MockResponse('', ['error' => 'Unavailable']);
}

if ($method === 'HEAD') {
return new MockResponse('');
}

return new MockResponse('mocked');
};

return new MockHttpClient($callback);
}

private function getPlace(): Place
{
$placeMock = $this->createMock(Place::class);
$placeMock->method('getTimeout')->willReturn(30.0);
$placeMock->method('getTimeout')->willReturn(2.0);

return $placeMock;
}
Expand Down

0 comments on commit 6820f1e

Please sign in to comment.