Skip to content

Commit b90ac97

Browse files
committed
fix tests
1 parent 8805097 commit b90ac97

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

spec/HttpMethodsClientSpec.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace spec\Http\Client\Common;
44

55
use Http\Client\Common\HttpMethodsClient;
6-
use Http\Client\HttpClient;
7-
use Http\Message\RequestFactory;
86
use PhpSpec\ObjectBehavior;
7+
use Psr\Http\Client\ClientInterface;
8+
use Psr\Http\Message\RequestFactoryInterface;
99
use Psr\Http\Message\RequestInterface;
1010
use Psr\Http\Message\ResponseInterface;
1111

@@ -19,7 +19,7 @@ class HttpMethodsClientSpec extends ObjectBehavior
1919
'body' => 'body',
2020
];
2121

22-
public function let(HttpClient $client, RequestFactory $requestFactory)
22+
public function let(ClientInterface $client, RequestFactoryInterface $requestFactory)
2323
{
2424
$this->beAnInstanceOf(
2525
HttpMethodsClient::class, [
@@ -29,42 +29,42 @@ public function let(HttpClient $client, RequestFactory $requestFactory)
2929
);
3030
}
3131

32-
public function it_sends_a_get_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
32+
public function it_sends_a_get_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
3333
{
3434
$this->assert($client, $requestFactory, $request, $response, 'get');
3535
}
3636

37-
public function it_sends_a_head_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
37+
public function it_sends_a_head_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
3838
{
3939
$this->assert($client, $requestFactory, $request, $response, 'head');
4040
}
4141

42-
public function it_sends_a_trace_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
42+
public function it_sends_a_trace_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
4343
{
4444
$this->assert($client, $requestFactory, $request, $response, 'trace');
4545
}
4646

47-
public function it_sends_a_post_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
47+
public function it_sends_a_post_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
4848
{
4949
$this->assert($client, $requestFactory, $request, $response, 'post', self::$requestData['body']);
5050
}
5151

52-
public function it_sends_a_put_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
52+
public function it_sends_a_put_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
5353
{
5454
$this->assert($client, $requestFactory, $request, $response, 'put', self::$requestData['body']);
5555
}
5656

57-
public function it_sends_a_patch_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
57+
public function it_sends_a_patch_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
5858
{
5959
$this->assert($client, $requestFactory, $request, $response, 'patch', self::$requestData['body']);
6060
}
6161

62-
public function it_sends_a_delete_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
62+
public function it_sends_a_delete_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
6363
{
6464
$this->assert($client, $requestFactory, $request, $response, 'delete', self::$requestData['body']);
6565
}
6666

67-
public function it_sends_an_options_request(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response)
67+
public function it_sends_an_options_request(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response)
6868
{
6969
$this->assert($client, $requestFactory, $request, $response, 'options', self::$requestData['body']);
7070
}
@@ -74,15 +74,15 @@ public function it_sends_an_options_request(HttpClient $client, RequestFactory $
7474
*
7575
* As there is no data provider in phpspec, we keep separate methods to get new mocks for each test.
7676
*/
77-
private function assert(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response, string $method, string $body = null)
77+
private function assert(ClientInterface $client, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response, string $method, string $body = null)
7878
{
7979
$client->sendRequest($request)->shouldBeCalled()->willReturn($response);
8080
$this->mockFactory($requestFactory, $request, strtoupper($method), $body);
8181

8282
$this->$method(self::$requestData['uri'], self::$requestData['headers'], self::$requestData['body'])->shouldReturnAnInstanceOf(ResponseInterface::class);
8383
}
8484

85-
private function mockFactory(RequestFactory $requestFactory, RequestInterface $request, string $method, string $body = null)
85+
private function mockFactory(RequestFactoryInterface $requestFactory, RequestInterface $request, string $method, string $body = null)
8686
{
8787
$requestFactory->createRequest($method, self::$requestData['uri'], self::$requestData['headers'], $body)->willReturn($request);
8888
}

0 commit comments

Comments
 (0)