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