Skip to content

Commit bc63278

Browse files
committed
add tests
1 parent 1c8a22f commit bc63278

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

integration/php/main.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
assertGetEntries($client);
1919
assertInsert($client);
2020
assertThrowException($client);
21+
assertBinary($client);
22+
assertForm($client);
23+
assertJson($client);
24+
assertText($client);
25+
assertXml($client);
2126

2227
function assertGetHello(\SDK\Client $client): void
2328
{
@@ -86,3 +91,57 @@ function assertThrowException(\SDK\Client $client): void
8691
}
8792
}
8893

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

Comments
 (0)