@@ 32-51 (lines=20) @@ | ||
29 | /** |
|
30 | * @test |
|
31 | */ |
|
32 | public function itExecutesAGetRequest() |
|
33 | { |
|
34 | /** @var Response|ObjectProphecy $response */ |
|
35 | $response = $this->prophesize(Response::class); |
|
36 | $response->getBody()->willReturn( |
|
37 | json_encode([ |
|
38 | 'Response' => [ |
|
39 | 'status' => 'OK' |
|
40 | ] |
|
41 | ]) |
|
42 | ); |
|
43 | ||
44 | $this->httpClient->request('GET', 'uri', [])->willReturn($response->reveal()); |
|
45 | ||
46 | $result = $this->client->get('uri'); |
|
47 | ||
48 | $expectedResult = ['Response' => ['status' => 'OK']]; |
|
49 | ||
50 | $this->assertEquals($expectedResult, $result); |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * @test |
|
@@ 56-75 (lines=20) @@ | ||
53 | /** |
|
54 | * @test |
|
55 | */ |
|
56 | public function itExecutesAPostRequest() |
|
57 | { |
|
58 | /** @var Response|ObjectProphecy $response */ |
|
59 | $response = $this->prophesize(Response::class); |
|
60 | $response->getBody()->willReturn( |
|
61 | json_encode([ |
|
62 | 'Response' => [ |
|
63 | 'status' => 'OK' |
|
64 | ] |
|
65 | ]) |
|
66 | ); |
|
67 | ||
68 | $this->httpClient->request('POST', 'uri', [])->willReturn($response->reveal()); |
|
69 | ||
70 | $result = $this->client->post('uri'); |
|
71 | ||
72 | $expectedResult = ['Response' => ['status' => 'OK']]; |
|
73 | ||
74 | $this->assertEquals($expectedResult, $result); |
|
75 | } |
|
76 | ||
77 | /** |
|
78 | * @test |
|
@@ 80-99 (lines=20) @@ | ||
77 | /** |
|
78 | * @test |
|
79 | */ |
|
80 | public function itExecutesAPutRequest() |
|
81 | { |
|
82 | /** @var Response|ObjectProphecy $response */ |
|
83 | $response = $this->prophesize(Response::class); |
|
84 | $response->getBody()->willReturn( |
|
85 | json_encode([ |
|
86 | 'Response' => [ |
|
87 | 'status' => 'OK' |
|
88 | ] |
|
89 | ]) |
|
90 | ); |
|
91 | ||
92 | $this->httpClient->request('PUT', 'uri', [])->willReturn($response->reveal()); |
|
93 | ||
94 | $result = $this->client->put('uri'); |
|
95 | ||
96 | $expectedResult = ['Response' => ['status' => 'OK']]; |
|
97 | ||
98 | $this->assertEquals($expectedResult, $result); |
|
99 | } |
|
100 | } |
|
101 | ||
102 |