@@ 105-123 (lines=19) @@ | ||
102 | /** |
|
103 | * @test |
|
104 | */ |
|
105 | public function canMakeGetRequestsWithAuthentication() |
|
106 | { |
|
107 | $this->setClient(['authToken' => 'myToken']); |
|
108 | ||
109 | $query = ['foo' => 'bar']; |
|
110 | ||
111 | $this->mockClient()->request( |
|
112 | 'GET', |
|
113 | $this->url('/foo'), |
|
114 | [ |
|
115 | 'auth' => ['myToken', ''], |
|
116 | 'query' => $query, |
|
117 | ] |
|
118 | )->willReturn($this->fooBarResponse()); |
|
119 | ||
120 | $data = $this->client->get('/foo', $query); |
|
121 | ||
122 | $this->assertFooBarResponse($data); |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * @test |
|
@@ 128-146 (lines=19) @@ | ||
125 | /** |
|
126 | * @test |
|
127 | */ |
|
128 | public function canMakeGetRequestsWithBasicAuthentication() |
|
129 | { |
|
130 | $this->setClient(['basicAuth' => ['username', 'password']]); |
|
131 | ||
132 | $query = ['foo' => 'bar']; |
|
133 | ||
134 | $this->mockClient()->request( |
|
135 | 'GET', |
|
136 | $this->url('/foo'), |
|
137 | [ |
|
138 | 'auth' => ['username', 'password'], |
|
139 | 'query' => $query, |
|
140 | ] |
|
141 | )->willReturn($this->fooBarResponse()); |
|
142 | ||
143 | $data = $this->client->get('/foo', $query); |
|
144 | ||
145 | $this->assertFooBarResponse($data); |
|
146 | } |
|
147 | ||
148 | /** |
|
149 | * @test |
|
@@ 250-262 (lines=13) @@ | ||
247 | /** |
|
248 | * @test |
|
249 | */ |
|
250 | public function passesOnHeaders() |
|
251 | { |
|
252 | $options = [ |
|
253 | 'headers' => ['Content-Type' => 'application/json; charset=utf-8'], |
|
254 | 'query' => [] |
|
255 | ]; |
|
256 | $this->mockClient()->request('GET', $this->url('/foo'), $options) |
|
257 | ->willReturn($this->fooBarResponse()); |
|
258 | ||
259 | $data = $this->client->get('/foo', [], ['headers' => ['Content-Type' => 'application/json; charset=utf-8']]); |
|
260 | ||
261 | $this->assertFooBarResponse($data); |
|
262 | } |
|
263 | ||
264 | /** |
|
265 | * @return \Prophecy\Prophecy\ObjectProphecy |