Lines Matching +full:server +full:-
6 * Tests are executed against an instance of go-httpbin
10 protected $server = 'http://httpbingo.org'; variable in httpclient_http_test
18 $data = $http->get($this->server . '/get?foo=bar');
19 if ($http->noconnection()) {
20 $this->markTestSkipped('connection timed out');
22 $this->assertFalse($data === false, $http->errorInfo());
24 $this->assertTrue(is_array($resp), 'JSON response');
25 $this->assertArrayHasKey('args', $resp);
26 $this->assertEquals(['foo' => ['bar']], $resp['args']);
35 $data = $http->dget($this->server . '/get', ['foo' => 'bar']);
36 if ($http->noconnection()) {
37 $this->markTestSkipped('connection timed out');
39 $this->assertFalse($data === false, $http->errorInfo());
41 $this->assertTrue(is_array($resp), 'JSON response');
42 $this->assertArrayHasKey('args', $resp);
43 $this->assertEquals(['foo' => ['bar']], $resp['args']);
52 $data = $http->get($this->server . '/gzip');
53 if ($http->noconnection()) {
54 $this->markTestSkipped('connection timed out');
56 $this->assertFalse($data === false, $http->errorInfo());
58 $this->assertTrue(is_array($resp), 'JSON response');
59 $this->assertArrayHasKey('gzipped', $resp);
60 $this->assertTrue($resp['gzipped']);
69 $data = $http->post($this->server . '/post', ['foo' => 'bar']);
70 if ($http->noconnection()) {
71 $this->markTestSkipped('connection timed out');
73 $this->assertFalse($data === false, $http->errorInfo());
75 $this->assertTrue(is_array($resp), 'JSON response');
76 $this->assertArrayHasKey('form', $resp);
77 $this->assertEquals(['foo' => ['bar']], $resp['form']);
86 $data = $http->get($this->server . '/redirect/3');
87 if ($http->noconnection()) {
88 $this->markTestSkipped('connection timed out');
90 $this->assertFalse($data === false, $http->errorInfo());
92 $this->assertTrue(is_array($resp), 'JSON response');
93 $this->assertArrayHasKey('url', $resp);
94 $this->assertMatchesRegularExpression('/\/get$/', $resp['url']);
103 $data = $http->get($this->server . '/relative-redirect/3');
104 if ($http->noconnection()) {
105 $this->markTestSkipped('connection timed out');
107 $this->assertFalse($data === false, $http->errorInfo());
109 $this->assertTrue(is_array($resp), 'JSON response');
110 $this->assertArrayHasKey('url', $resp);
111 $this->assertMatchesRegularExpression('/\/get$/', $resp['url']);
120 $data = $http->get($this->server . '/redirect/5');
121 if ($http->noconnection()) {
122 $this->markTestSkipped('connection timed out');
124 $this->assertTrue($data === false, $http->errorInfo());
125 $this->assertEquals('Maximum number of redirects exceeded', $http->error);
134 $http->get($this->server . '/cookies/set?foo=bar');
135 if ($http->noconnection()) {
136 $this->markTestSkipped('connection timed out');
138 $this->assertEquals(['foo' => 'bar'], $http->cookies);
139 $data = $http->get($this->server . '/cookies');
140 if ($http->noconnection()) {
141 $this->markTestSkipped('connection timed out');
143 $this->assertFalse($data === false, $http->errorInfo());
145 $this->assertTrue(is_array($resp), 'JSON response');
146 $this->assertEquals(['foo' => 'bar'], $resp);
155 $data = $http->get($this->server . '/status/418');
156 if ($http->noconnection()) {
157 $this->markTestSkipped('connection timed out');
159 $this->assertTrue($data === false, $http->errorInfo());
160 $this->assertEquals(418, $http->status);
169 $http->max_bodysize = 250;
172 $data = $http->get($this->server . '/stream/30');
173 if ($http->noconnection()) {
174 $this->markTestSkipped('connection timed out');
176 $this->assertTrue($data === false, $http->errorInfo());
179 $http->max_bodysize_abort = false;
180 $http->keep_alive = false;
181 $data = $http->get($this->server . '/stream/30');
182 if ($http->noconnection()) {
183 $this->markTestSkipped('connection timed out');
185 $this->assertFalse($data === false, $http->errorInfo());
187 $this->assertLessThanOrEqual(251, strlen($data));
196 $http->max_bodysize = 500 * 1024;
197 $data = $http->get($this->server . '/stream/5');
198 if ($http->noconnection()) {
199 $this->markTestSkipped('connection timed out');
201 $this->assertTrue($data !== false, $http->errorInfo());
202 $http->max_bodysize_abort = false;
203 $data = $http->get($this->server . '/stream/5');
204 if ($http->noconnection()) {
205 $this->markTestSkipped('connection timed out');
207 $this->assertTrue($data !== false, $http->errorInfo());
216 $http->user = 'user';
217 $http->pass = 'pass';
218 $data = $http->get($this->server . '/basic-auth/user/pass');
219 if ($http->noconnection()) {
220 $this->markTestSkipped('connection timed out');
222 $this->assertFalse($data === false, $http->errorInfo());
224 $this->assertTrue(is_array($resp), 'JSON response');
225 $this->assertEquals(['authorized' => true, 'user' => 'user'], $resp);
234 $http->user = 'user';
235 $http->pass = 'invalid';
236 $data = $http->get($this->server . '/basic-auth/user/pass');
237 if ($http->noconnection()) {
238 $this->markTestSkipped('connection timed out');
240 $this->assertTrue($data === false, $http->errorInfo());
241 $this->assertEquals(401, $http->status);
250 $http->timeout = 5;
251 $data = $http->get($this->server . '/delay/10');
252 $this->assertTrue($data === false, $http->errorInfo());
253 $this->assertEquals(-100, $http->status);
262 $data = $http->get($this->server . '/response-headers?baz=&foo=bar');
263 if ($http->noconnection()) {
264 $this->markTestSkipped('connection timed out');
266 $this->assertFalse($data === false, $http->errorInfo());
268 $this->assertTrue(is_array($resp), 'JSON response');
269 $this->assertArrayHasKey('baz', $http->resp_headers);
270 $this->assertArrayHasKey('foo', $http->resp_headers);
271 $this->assertEquals('bar', $http->resp_headers['foo']);
280 $data = $http->get($this->server . '/stream-bytes/5000?chunk_size=250');
281 if ($http->noconnection()) {
282 $this->markTestSkipped('connection timed out');
284 $this->assertFalse($data === false, $http->errorInfo());
285 $this->assertEquals(5000, strlen($data));
297 $data = $http->get('http://www.wikimatrix.org/cfeed/dokuwiki/-/-');
298 if ($http->noconnection()) {
299 $this->markTestSkipped('connection timed out');
301 $this->assertTrue($data !== false, $http->errorInfo());
316 $this->assertEquals(
318 $this->callInaccessibleMethod($http, 'postEncode', [$data]),
327 $this->assertEquals(
329 $this->callInaccessibleMethod($http, 'postEncode', [$data]),
338 $this->assertEquals(
340 $this->callInaccessibleMethod($http, 'postEncode', [$data]),
349 $this->assertEquals(
351 $this->callInaccessibleMethod($http, 'postEncode', [$data]),