X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2F4LocalhostMultiTest.php;h=2489ae544a7d349a94cc919dbed69583a89df63c;hb=1ca4b1e930fd6d697d8c6947fca4a02ce5725fa9;hp=2b2ba6707752e62ebadfbb27223d6f13a0ad0c27;hpb=e640c12e8f1cbc263f766035b0113ad132285e2a;p=plcapi.git diff --git a/tests/4LocalhostMultiTest.php b/tests/4LocalhostMultiTest.php index 2b2ba67..2489ae5 100644 --- a/tests/4LocalhostMultiTest.php +++ b/tests/4LocalhostMultiTest.php @@ -7,6 +7,10 @@ include_once __DIR__ . '/parse_args.php'; include_once __DIR__ . '/3LocalhostTest.php'; +/** + * Tests which stress http features of the library. + * Each of these tests iterates over (almost) all of the 'localhost' tests + */ class LocalhostMultiTest extends LocalhostTest { /** @@ -15,9 +19,10 @@ class LocalhostMultiTest extends LocalhostTest */ function _runtests() { + $unsafeMethods = array('testHttps', 'testCatchExceptions', 'testUtf8Method', 'testServerComments', 'testExoticCharsetsRequests2'); foreach(get_class_methods('LocalhostTest') as $method) { - if(strpos($method, 'test') === 0 && $method != 'testHttps' && $method != 'testCatchExceptions') + if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods)) { if (!isset(self::$failed_tests[$method])) $this->$method(); @@ -33,7 +38,7 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('gzdeflate')) { - $this->fail('Zlib missing: cannot test deflate functionality'); + $this->markTestSkipped('Zlib missing: cannot test deflate functionality'); return; } $this->client->accepted_compression = array('deflate'); @@ -45,7 +50,7 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('gzdeflate')) { - $this->fail('Zlib missing: cannot test gzip functionality'); + $this->markTestSkipped('Zlib missing: cannot test gzip functionality'); return; } $this->client->accepted_compression = array('gzip'); @@ -57,7 +62,7 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test http 1.1'); + $this->markTestSkipped('CURL missing: cannot test http 1.1'); return; } $this->method = 'http11'; @@ -73,14 +78,14 @@ class LocalhostMultiTest extends LocalhostTest $this->_runtests(); } else - $this->fail('PROXY definition missing: cannot test proxy'); + $this->markTestSkipped('PROXY definition missing: cannot test proxy'); } function testHttp11() { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test http 1.1'); + $this->markTestSkipped('CURL missing: cannot test http 1.1'); return; } $this->method = 'http11'; // not an error the double assignment! @@ -95,7 +100,7 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test http 1.1'); + $this->markTestSkipped('CURL missing: cannot test http 1.1'); return; } $this->method = 'http11'; // not an error the double assignment! @@ -110,7 +115,7 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test http 1.1'); + $this->markTestSkipped('CURL missing: cannot test http 1.1'); return; } $this->method = 'http11'; // not an error the double assignment! @@ -125,12 +130,12 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test http 1.1 w. proxy'); + $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy'); return; } else if ($this->args['PROXYSERVER'] == '') { - $this->fail('PROXY definition missing: cannot test proxy w. http 1.1'); + $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1'); return; } $this->method = 'http11'; // not an error the double assignment! @@ -146,15 +151,16 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test https functionality'); + $this->markTestSkipped('CURL missing: cannot test https functionality'); return; } $this->client->server = $this->args['HTTPSSERVER']; $this->method = 'https'; $this->client->method = 'https'; $this->client->path = $this->args['HTTPSURI']; - $this->client->setSSLVerifyPeer( !$this->args['HTTPSIGNOREPEER'] ); - $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST'] ); + $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']); + $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']); + $this->client->setSSLVersion($this->args['SSLVERSION']); $this->_runtests(); } @@ -162,12 +168,12 @@ class LocalhostMultiTest extends LocalhostTest { if(!function_exists('curl_init')) { - $this->fail('CURL missing: cannot test https functionality'); + $this->markTestSkipped('CURL missing: cannot test https functionality'); return; } else if ($this->args['PROXYSERVER'] == '') { - $this->fail('PROXY definition missing: cannot test proxy w. http 1.1'); + $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1'); return; } $this->client->server = $this->args['HTTPSSERVER']; @@ -175,8 +181,9 @@ class LocalhostMultiTest extends LocalhostTest $this->client->method = 'https'; $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']); $this->client->path = $this->args['HTTPSURI']; - $this->client->setSSLVerifyPeer( !$this->args['HTTPSIGNOREPEER'] ); - $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST'] ); + $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']); + $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']); + $this->client->setSSLVersion($this->args['SSLVERSION']); $this->_runtests(); }