@@ -232,6 +232,24 @@ public function get()
232232 $ this ->assertSame (['Content-Type ' => ['application/json ' ]], $ response ->getResponseHeaders ());
233233 }
234234
235+ /**
236+ * @test
237+ * @covers ::get
238+ * @covers ::startGet
239+ * @uses \DominionEnterprises\Api\Client::end
240+ */
241+ public function getWithParameters ()
242+ {
243+ $ authentication = Authentication::createClientCredentials ('not under test ' , 'not under test ' );
244+ $ client = new Client (new GetWithParametersAdapter (), $ authentication , 'baseUrl/v1 ' );
245+
246+ $ response = $ client ->get ('resource name ' , 'the id ' , ['foo ' => 'bar ' ]);
247+
248+ $ this ->assertSame (200 , $ response ->getHttpCode ());
249+ $ this ->assertSame (['key ' => 'value ' ], $ response ->getResponse ());
250+ $ this ->assertSame (['Content-Type ' => ['application/json ' ]], $ response ->getResponseHeaders ());
251+ }
252+
235253 /**
236254 * @test
237255 * @covers ::put
@@ -668,6 +686,29 @@ public function end($handle)
668686 }
669687}
670688
689+ final class GetWithParametersAdapter implements Adapter
690+ {
691+ private $ _request ;
692+
693+ public function start (Request $ request )
694+ {
695+ $ this ->_request = $ request ;
696+ }
697+
698+ public function end ($ handle )
699+ {
700+ if (substr ($ this ->_request ->getUrl (), -5 ) === 'token ' ) {
701+ return new Response (200 , ['Content-Type ' => ['application/json ' ]], ['access_token ' => 'a token ' , 'expires_in ' => 1 ]);
702+ }
703+
704+ if ($ this ->_request ->getMethod () === 'GET ' && $ this ->_request ->getUrl () === 'baseUrl/v1/resource+name/the+id?foo=bar ' ) {
705+ return new Response (200 , ['Content-Type ' => ['application/json ' ]], ['key ' => 'value ' ]);
706+ }
707+
708+ throw new \Exception ('Unexpected request ' );
709+ }
710+ }
711+
671712final class PutAdapter implements Adapter
672713{
673714 private $ _request ;
0 commit comments