|
18 | 18 | assertGetEntries($client);
|
19 | 19 | assertInsert($client);
|
20 | 20 | assertThrowException($client);
|
| 21 | +assertBinary($client); |
| 22 | +assertForm($client); |
| 23 | +assertJson($client); |
| 24 | +assertText($client); |
| 25 | +assertXml($client); |
21 | 26 |
|
22 | 27 | function assertGetHello(\SDK\Client $client): void
|
23 | 28 | {
|
@@ -86,3 +91,57 @@ function assertThrowException(\SDK\Client $client): void
|
86 | 91 | }
|
87 | 92 | }
|
88 | 93 |
|
| 94 | +function assertBinary(\SDK\Client $client): void |
| 95 | +{ |
| 96 | + $payload = \GuzzleHttp\Stream\Stream::factory('foobar'); |
| 97 | + |
| 98 | + $response = $client->test()->binary($payload); |
| 99 | + |
| 100 | + if ($response->getContents() !== 'foobar') { |
| 101 | + throw new RuntimeException("Test assertBinary failed"); |
| 102 | + } |
| 103 | +} |
| 104 | + |
| 105 | +function assertForm(\SDK\Client $client): void |
| 106 | +{ |
| 107 | + $payload = ['foo' => 'bar']; |
| 108 | + |
| 109 | + $response = $client->test()->form($payload); |
| 110 | + |
| 111 | + if ($payload !== $response) { |
| 112 | + throw new RuntimeException("Test assertForm failed"); |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +function assertJson(\SDK\Client $client): void |
| 117 | +{ |
| 118 | + $payload = ['foo' => 'bar']; |
| 119 | + |
| 120 | + $response = $client->test()->json($payload); |
| 121 | + |
| 122 | + if ($payload !== $response) { |
| 123 | + throw new RuntimeException("Test assertJson failed"); |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +function assertText(\SDK\Client $client): void |
| 128 | +{ |
| 129 | + $payload = 'foobar'; |
| 130 | + |
| 131 | + $response = $client->test()->json($payload); |
| 132 | + |
| 133 | + if ($payload !== $response) { |
| 134 | + throw new RuntimeException("Test assertText failed"); |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +function assertXml(\SDK\Client $client): void |
| 139 | +{ |
| 140 | + $payload = '<foo>bar</foo>'; |
| 141 | + |
| 142 | + $response = $client->test()->xml($payload); |
| 143 | + |
| 144 | + if ($payload !== $response) { |
| 145 | + throw new RuntimeException("Test assertText failed"); |
| 146 | + } |
| 147 | +} |
0 commit comments