3 include_once __DIR__ . '/../lib/xmlrpc.inc';
4 include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
6 include_once __DIR__ . '/parse_args.php';
8 include_once __DIR__ . '/3LocalhostTest.php';
11 * Tests which stress http features of the library.
12 * Each of these tests iterates over (almost) all of the 'localhost' tests
14 class LocalhostMultiTest extends LocalhostTest
17 * Returns all test methods from the base class, except the ones which failed already
19 * @todo reintroduce skipping of tests which failed when executed individually if test runs happen as separate processes
20 * @todo reintroduce skipping of tests within the loop
22 public function getSingleHttpTestMethods()
24 $unsafeMethods = array(
25 'testHttps', 'testCatchExceptions', 'testUtf8Method', 'testServerComments',
26 'testExoticCharsetsRequests', 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3',
30 foreach(get_class_methods('LocalhostTest') as $method)
32 if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
34 if (!isset(self::$failed_tests[$method])) {
35 $methods[$method] = array($method);
44 * @dataProvider getSingleHttpTestMethods
45 * @param string $method
47 public function testDeflate($method)
49 if(!function_exists('gzdeflate'))
51 $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
55 $this->client->accepted_compression = array('deflate');
56 $this->client->request_compression = 'deflate';
62 * @dataProvider getSingleHttpTestMethods
63 * @param string $method
65 public function testGzip($method)
67 if(!function_exists('gzdeflate'))
69 $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
73 $this->client->accepted_compression = array('gzip');
74 $this->client->request_compression = 'gzip';
79 public function testKeepAlives()
81 if(!function_exists('curl_init'))
83 $this->markTestSkipped('CURL missing: cannot test http 1.1');
87 $this->method = 'http11';
88 $this->client->method = 'http11';
89 $this->client->keepalive = true;
91 // to successfully test keepalive, we have to reuse the same client for all tests, we can not recreate one on setup/teardown...
92 foreach ($this->getSingleHttpTestMethods() as $methods) {
93 $method = $methods[0];
99 * @dataProvider getSingleHttpTestMethods
100 * @param string $method
102 public function testProxy($method)
104 if ($this->args['PROXYSERVER'] == '')
106 $this->markTestSkipped('PROXY definition missing: cannot test proxy');
110 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
116 * @dataProvider getSingleHttpTestMethods
117 * @param string $method
119 public function testHttp11($method)
121 if(!function_exists('curl_init'))
123 $this->markTestSkipped('CURL missing: cannot test http 1.1');
127 $this->method = 'http11'; // not an error the double assignment!
128 $this->client->method = 'http11';
129 $this->client->keepalive = false;
135 * @dataProvider getSingleHttpTestMethods
136 * @param string $method
138 public function testHttp11Gzip($method)
140 if(!function_exists('curl_init'))
142 $this->markTestSkipped('CURL missing: cannot test http 1.1');
145 $this->method = 'http11'; // not an error the double assignment!
146 $this->client->method = 'http11';
147 $this->client->keepalive = false;
148 $this->client->accepted_compression = array('gzip');
149 $this->client->request_compression = 'gzip';
155 * @dataProvider getSingleHttpTestMethods
156 * @param string $method
158 public function testHttp11Deflate($method)
160 if(!function_exists('curl_init'))
162 $this->markTestSkipped('CURL missing: cannot test http 1.1');
165 $this->method = 'http11'; // not an error the double assignment!
166 $this->client->method = 'http11';
167 $this->client->keepalive = false;
168 $this->client->accepted_compression = array('deflate');
169 $this->client->request_compression = 'deflate';
175 * @dataProvider getSingleHttpTestMethods
176 * @param string $method
178 public function testHttp11Proxy($method)
180 if(!function_exists('curl_init'))
182 $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
185 else if ($this->args['PROXYSERVER'] == '')
187 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
191 $this->method = 'http11'; // not an error the double assignment!
192 $this->client->method = 'http11';
193 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
194 $this->client->keepalive = false;
200 * @dataProvider getSingleHttpTestMethods
201 * @param string $method
203 public function testHttps($method)
205 if(!function_exists('curl_init'))
207 $this->markTestSkipped('CURL missing: cannot test https functionality');
210 else if ($this->args['HTTPSSERVER'] == '')
212 $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https');
216 $this->client->server = $this->args['HTTPSSERVER'];
217 $this->method = 'https';
218 $this->client->method = 'https';
219 $this->client->path = $this->args['HTTPSURI'];
220 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
221 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
222 $this->client->setSSLVersion($this->args['SSLVERSION']);
228 * @dataProvider getSingleHttpTestMethods
229 * @param string $method
231 public function testHttpsProxy($method)
233 if(!function_exists('curl_init'))
235 $this->markTestSkipped('CURL missing: cannot test https w. proxy');
238 else if ($this->args['PROXYSERVER'] == '')
240 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. https');
243 else if ($this->args['HTTPSSERVER'] == '')
245 $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https w. proxy');
249 $this->client->server = $this->args['HTTPSSERVER'];
250 $this->method = 'https';
251 $this->client->method = 'https';
252 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
253 $this->client->path = $this->args['HTTPSURI'];
254 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
255 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
256 $this->client->setSSLVersion($this->args['SSLVERSION']);
262 * @dataProvider getSingleHttpTestMethods
263 * @param string $method
265 public function testUTF8Responses($method)
267 $this->addQueryParams(array('RESPONSE_ENCODING' => 'UTF-8'));
273 * @dataProvider getSingleHttpTestMethods
274 * @param string $method
276 public function testUTF8Requests($method)
278 $this->client->request_charset_encoding = 'UTF-8';
284 * @dataProvider getSingleHttpTestMethods
285 * @param string $method
287 public function testISOResponses($method)
289 $this->addQueryParams(array('RESPONSE_ENCODING' => 'ISO-8859-1'));
295 * @dataProvider getSingleHttpTestMethods
296 * @param string $method
298 public function testISORequests($method)
300 $this->client->request_charset_encoding = 'ISO-8859-1';
306 * @dataProvider getSingleHttpTestMethods
307 * @param string $method
309 public function testBasicAuth($method)
311 $this->client->setCredentials('test', 'test');
312 $this->addQueryParams(array('FORCE_AUTH' => 'Basic'));
318 * @dataProvider getSingleHttpTestMethods
319 * @param string $method
321 public function testDigestAuth($method)
323 if (!function_exists('curl_init'))
325 $this->markTestSkipped('CURL missing: cannot test digest auth functionality');
329 $this->client->setCredentials('test', 'test', CURLAUTH_DIGEST);
330 $this->addQueryParams(array('FORCE_AUTH' => 'Digest'));
331 $this->method = 'http11';
332 $this->client->method = 'http11';