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('testHttps', 'testCatchExceptions', 'testUtf8Method', 'testServerComments', 'testExoticCharsetsRequests',
25 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3',
26 // @todo the following are currently not compatible w Digest Auth (most likely because of client copy) and should be fixed
27 'testcatchWarnings', 'testWrappedMethodAsSource', 'testTransferOfObjectViaWrapping');
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 $method) {
98 * @dataProvider getSingleHttpTestMethods
99 * @param string $method
101 public function testProxy($method)
103 if (!$this->args['PROXYSERVER'])
105 $this->markTestSkipped('PROXY definition missing: cannot test proxy');
109 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
115 * @dataProvider getSingleHttpTestMethods
116 * @param string $method
118 public function testHttp11($method)
120 if(!function_exists('curl_init'))
122 $this->markTestSkipped('CURL missing: cannot test http 1.1');
126 $this->method = 'http11'; // not an error the double assignment!
127 $this->client->method = 'http11';
128 $this->client->keepalive = false;
134 * @dataProvider getSingleHttpTestMethods
135 * @param string $method
137 public function testHttp11Gzip($method)
139 if(!function_exists('curl_init'))
141 $this->markTestSkipped('CURL missing: cannot test http 1.1');
144 $this->method = 'http11'; // not an error the double assignment!
145 $this->client->method = 'http11';
146 $this->client->keepalive = false;
147 $this->client->accepted_compression = array('gzip');
148 $this->client->request_compression = 'gzip';
154 * @dataProvider getSingleHttpTestMethods
155 * @param string $method
157 public function testHttp11Deflate($method)
159 if(!function_exists('curl_init'))
161 $this->markTestSkipped('CURL missing: cannot test http 1.1');
164 $this->method = 'http11'; // not an error the double assignment!
165 $this->client->method = 'http11';
166 $this->client->keepalive = false;
167 $this->client->accepted_compression = array('deflate');
168 $this->client->request_compression = 'deflate';
174 * @dataProvider getSingleHttpTestMethods
175 * @param string $method
177 public function testHttp11Proxy($method)
179 if(!function_exists('curl_init'))
181 $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
184 else if ($this->args['PROXYSERVER'] == '')
186 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
190 $this->method = 'http11'; // not an error the double assignment!
191 $this->client->method = 'http11';
192 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
193 $this->client->keepalive = false;
199 * @dataProvider getSingleHttpTestMethods
200 * @param string $method
202 public function testHttps($method)
204 if(!function_exists('curl_init'))
206 $this->markTestSkipped('CURL missing: cannot test https functionality');
210 $this->client->server = $this->args['HTTPSSERVER'];
211 $this->method = 'https';
212 $this->client->method = 'https';
213 $this->client->path = $this->args['HTTPSURI'];
214 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
215 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
216 $this->client->setSSLVersion($this->args['SSLVERSION']);
222 * @dataProvider getSingleHttpTestMethods
223 * @param string $method
225 public function testHttpsProxy($method)
227 if(!function_exists('curl_init'))
229 $this->markTestSkipped('CURL missing: cannot test https functionality');
232 else if ($this->args['PROXYSERVER'] == '')
234 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
237 $this->client->server = $this->args['HTTPSSERVER'];
238 $this->method = 'https';
239 $this->client->method = 'https';
240 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
241 $this->client->path = $this->args['HTTPSURI'];
242 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
243 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
244 $this->client->setSSLVersion($this->args['SSLVERSION']);
250 * @dataProvider getSingleHttpTestMethods
251 * @param string $method
253 public function testUTF8Responses($method)
255 $this->addQueryParams(array('RESPONSE_ENCODING' => 'UTF-8'));
261 * @dataProvider getSingleHttpTestMethods
262 * @param string $method
264 public function testUTF8Requests($method)
266 $this->client->request_charset_encoding = 'UTF-8';
272 * @dataProvider getSingleHttpTestMethods
273 * @param string $method
275 public function testISOResponses($method)
277 $this->addQueryParams(array('RESPONSE_ENCODING' => 'ISO-8859-1'));
283 * @dataProvider getSingleHttpTestMethods
284 * @param string $method
286 public function testISORequests($method)
288 $this->client->request_charset_encoding = 'ISO-8859-1';
294 * @dataProvider getSingleHttpTestMethods
295 * @param string $method
297 public function testBasicAuth($method)
299 $this->client->setCredentials('test', 'test');
300 $this->addQueryParams(array('FORCE_AUTH' => 'Basic'));
306 * @dataProvider getSingleHttpTestMethods
307 * @param string $method
309 public function testDigestAuth($method)
311 if (!function_exists('curl_init'))
313 $this->markTestSkipped('CURL missing: cannot test digest auth functionality');
317 $this->client->setCredentials('test', 'test', CURLAUTH_DIGEST);
318 $this->addQueryParams(array('FORCE_AUTH' => 'Digest'));
319 $this->method = 'http11';
320 $this->client->method = 'http11';