| @@ 51-67 (lines=17) @@ | ||
| 48 | /** |
|
| 49 | * @test |
|
| 50 | */ |
|
| 51 | public function canMakeGetRequests() |
|
| 52 | { |
|
| 53 | $query = ['foo' => 'bar']; |
|
| 54 | ||
| 55 | $this->mockClient()->request( |
|
| 56 | 'GET', |
|
| 57 | $this->url('/foo'), |
|
| 58 | [ |
|
| 59 | 'auth' => ['myToken', ''], |
|
| 60 | 'query' => $query, |
|
| 61 | ] |
|
| 62 | )->willReturn($this->fooBarResponse()); |
|
| 63 | ||
| 64 | $data = $this->client->get('/foo', $query); |
|
| 65 | ||
| 66 | $this->assertFooBarResponse($data); |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * @test |
|
| @@ 72-88 (lines=17) @@ | ||
| 69 | /** |
|
| 70 | * @test |
|
| 71 | */ |
|
| 72 | public function canMakePostRequests() |
|
| 73 | { |
|
| 74 | $postData = ['foo' => 'bar']; |
|
| 75 | ||
| 76 | $this->mockClient()->request( |
|
| 77 | 'POST', |
|
| 78 | $this->url('/foo'), |
|
| 79 | [ |
|
| 80 | 'auth' => ['myToken', ''], |
|
| 81 | 'form_params' => $postData, |
|
| 82 | ] |
|
| 83 | )->willReturn($this->fooBarResponse()); |
|
| 84 | ||
| 85 | $data = $this->client->post('/foo', $postData); |
|
| 86 | ||
| 87 | $this->assertFooBarResponse($data); |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @test |
|
| @@ 93-109 (lines=17) @@ | ||
| 90 | /** |
|
| 91 | * @test |
|
| 92 | */ |
|
| 93 | public function canMakePutRequest() |
|
| 94 | { |
|
| 95 | $putData = ['foo' => 'bar']; |
|
| 96 | ||
| 97 | $this->mockClient()->request( |
|
| 98 | 'PUT', |
|
| 99 | $this->url('/foo'), |
|
| 100 | [ |
|
| 101 | 'auth' => ['myToken', ''], |
|
| 102 | 'json' => $putData, |
|
| 103 | ] |
|
| 104 | )->willReturn($this->fooBarResponse()); |
|
| 105 | ||
| 106 | $data = $this->client->put('/foo', $putData); |
|
| 107 | ||
| 108 | $this->assertFooBarResponse($data); |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * @return \Prophecy\Prophecy\ObjectProphecy |
|