From: gggeek <giunta.gaetano@gmail.com>
Date: Sat, 1 Jul 2017 13:49:22 +0000 (+0100)
Subject: set https options for tests
X-Git-Tag: 3.1.0~14
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2e4d7e8aedf960a3b5c5d0eeb29f4a1175142011;p=plcapi.git

set https options for tests
---

diff --git a/test/ci/travis/setup_php_fpm.sh b/test/ci/travis/setup_php_fpm.sh
index 502b07be..e9ad9c63 100755
--- a/test/ci/travis/setup_php_fpm.sh
+++ b/test/ci/travis/setup_php_fpm.sh
@@ -6,7 +6,10 @@ sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.ph
 if [ "$TRAVIS_PHP_VERSION" = "7.0" -a -n "$(ls -A ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d)" ]; then
   sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
 fi
+
+# NB: the following does not seem to work with php 5.3...
 echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
 echo "always_populate_raw_post_data = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
 echo "include_path = '.:$(pwd)/lib'" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+
 ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
diff --git a/test/parse_args.php b/test/parse_args.php
index d47168c5..1301f418 100644
--- a/test/parse_args.php
+++ b/test/parse_args.php
@@ -83,6 +83,10 @@
 	{
 		$HTTPSIGNOREPEER = false;
 	}
+	if(!isset($HTTPSVERIFYHOST))
+	{
+		$HTTPSVERIFYHOST = 2;
+	}
 	if(!isset($PROXY))
 	{
 		$PROXYSERVER = null;
diff --git a/test/testsuite.php b/test/testsuite.php
index 39874cea..e5fb6d8d 100644
--- a/test/testsuite.php
+++ b/test/testsuite.php
@@ -774,7 +774,7 @@ class LocalHostMultiTests extends LocalhostTests
 
     function testHttps()
     {
-        global $HTTPSSERVER, $HTTPSURI, $HTTPSIGNOREPEER;
+        global $HTTPSSERVER, $HTTPSURI, $HTTPSIGNOREPEER, $HTTPSVERIFYHOST;
         if(!function_exists('curl_init'))
         {
             $this->fail('CURL missing: cannot test https functionality');
@@ -784,15 +784,14 @@ class LocalHostMultiTests extends LocalhostTests
         $this->method = 'https';
         $this->client->method = 'https';
         $this->client->path = $HTTPSURI;
-        $this->client->setSSLVerifyPeer( !$HTTPSIGNOREPEER );
-        // silence warning with newish php versions
-        $this->client->setSSLVerifyHost(2);
+        $this->client->setSSLVerifyPeer(!$HTTPSIGNOREPEER);
+        $this->client->setSSLVerifyHost($HTTPSVERIFYHOST);
         $this->_runtests();
     }
 
     function testHttpsProxy()
     {
-        global $HTTPSSERVER, $HTTPSURI, $PROXYSERVER, $PROXYPORT, $NOPROXY;
+        global $HTTPSSERVER, $HTTPSURI, $HTTPSIGNOREPEER, $HTTPSVERIFYHOST, $PROXYSERVER, $PROXYPORT, $NOPROXY;
         if(!function_exists('curl_init'))
         {
             $this->fail('CURL missing: cannot test https functionality');
@@ -809,6 +808,8 @@ class LocalHostMultiTests extends LocalhostTests
         $this->client->method = 'https';
         $this->client->setProxy($PROXYSERVER, $PROXYPORT);
         $this->client->path = $HTTPSURI;
+        $this->client->setSSLVerifyPeer(!$HTTPSIGNOREPEER);
+        $this->client->setSSLVerifyHost($HTTPSVERIFYHOST);
         $this->_runtests();
     }
 
@@ -888,7 +889,7 @@ class ParsingBugsTests extends PHPUnit_TestCase
         $m=new xmlrpcmsg('dummy');
         $r=$m->parseResponse($response);
         $v=$r->faultString();
-        $this->assertEquals('���àüè', $v);
+        $this->assertEquals('������', $v);
     }
 
     function testValidNumbers()