@@ -18,29 +18,36 @@ class PingSpec extends ObjectBehavior
1818 public function it_should_perform_start (ClientInterface $ httpClient , ResponseInterface $ response )
1919 {
2020 $ httpClient ->sendRequest (new TypeToken (RequestInterface::class))->shouldBeCalled ()->willReturn ($ response );
21- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
21+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
2222 $ this ->start ();
2323 }
2424
2525 public function it_should_perform_success (ClientInterface $ httpClient , ResponseInterface $ response )
2626 {
2727 $ httpClient ->sendRequest (new TypeToken (RequestInterface::class))->shouldBeCalled ()->willReturn ($ response );
28- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
28+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
2929 $ this ->success ();
3030 }
3131
3232 public function it_should_perform_fail (ClientInterface $ httpClient , ResponseInterface $ response )
3333 {
3434 $ httpClient ->sendRequest (new TypeToken (RequestInterface::class))->shouldBeCalled ()->willReturn ($ response );
35- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
35+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
3636 $ this ->fail ();
3737 }
3838
39- public function it_should_change_uuid (ClientInterface $ httpClient , ResponseInterface $ response )
39+ public function it_should_change_uuid ()
4040 {
41+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' );
4142 $ this ->withUuid ('test ' )->shouldReturnAnInstanceOf (Ping::class);
4243 }
4344
45+ public function it_should_change_http_client (ClientInterface $ httpClient )
46+ {
47+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' );
48+ $ this ->withHttpClient ($ httpClient )->shouldReturnAnInstanceOf (Ping::class);
49+ }
50+
4451 public function it_should_handle_HTTP_BAD_REQUEST (ClientInterface $ httpClient , ResponseInterface $ response , ClientExceptionInterface $ error )
4552 {
4653 $ httpClient ->sendRequest (new TypeToken (RequestInterface::class))->shouldBeCalled ()
@@ -58,7 +65,7 @@ public function getResponse(): ResponseInterface
5865 })
5966 ;
6067 $ response ->getStatusCode ()->shouldBeCalled ()->willReturn (400 );
61- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
68+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
6269 $ this ->shouldThrow (Exceptions \InvalidPayloadError::class)->duringStart ();
6370 }
6471
@@ -79,7 +86,7 @@ public function getResponse(): ResponseInterface
7986 })
8087 ;
8188 $ response ->getStatusCode ()->shouldBeCalled ()->willReturn (401 );
82- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
89+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
8390 $ this ->shouldThrow (Exceptions \UnauthorisedError::class)->duringStart ();
8491 }
8592
@@ -100,7 +107,7 @@ public function getResponse(): ResponseInterface
100107 })
101108 ;
102109 $ response ->getStatusCode ()->shouldBeCalled ()->willReturn (403 );
103- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
110+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
104111 $ this ->shouldThrow (Exceptions \AccountLimitReached::class)->duringStart ();
105112 }
106113
@@ -121,7 +128,7 @@ public function getResponse(): ResponseInterface
121128 })
122129 ;
123130 $ response ->getStatusCode ()->shouldBeCalled ()->willReturn (404 );
124- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
131+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
125132 $ this ->shouldThrow (Exceptions \UuidNotFound::class)->duringStart ();
126133 }
127134
@@ -142,7 +149,7 @@ public function getResponse(): ResponseInterface
142149 })
143150 ;
144151 $ response ->getStatusCode ()->shouldBeCalled ()->willReturn (500 );
145- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
152+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
146153 $ this ->shouldThrow (Exceptions \FailureError::class)->duringStart ();
147154 }
148155
@@ -152,7 +159,7 @@ public function it_should_handle_Generic_HTTP_5xx(ClientInterface $httpClient, C
152159 ->willThrow (new class ('test ' ) extends \Exception implements ClientExceptionInterface {
153160 })
154161 ;
155- $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , null , $ httpClient );
162+ $ this ->beConstructedWith ('none ' , 'https://foo.dev ' , $ httpClient );
156163 $ this ->shouldThrow (Exceptions \FailureError::class)->duringStart ();
157164 }
158165}
0 commit comments