From 49c963542df3ada44bf369281cbea420513d7c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 28 Jun 2017 15:40:00 +0200 Subject: [PATCH] Add tests for both paths in curl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test both CURLOPT_CAPATH and URLOPT_CAINFO setup. Fixes #13398 Signed-off-by: Michal Čihař --- test/classes/UtilTest.php | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 821b27d8c3..4f9c3e2822 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -168,6 +168,46 @@ class UtilTest extends PMATestCase $this->validateHttp($result, $expected); } + /** + * Test for http request using Curl with CURLOPT_CAPATH + * + * @group medium + * + * @return void + * + * @dataProvider httpRequests + * + * @group network + */ + public function testHttpRequestCurlCAPath($url, $method, $return_only_status, $expected) + { + if (! function_exists('curl_init')) { + $this->markTestSkipped('curl not supported'); + } + $result = PMA\libraries\Util::httpRequestCurl($url, $method, $return_only_status, null, '', CURLOPT_CAPATH); + $this->validateHttp($result, $expected); + } + + /** + * Test for http request using Curl with CURLOPT_CAINFO + * + * @group medium + * + * @return void + * + * @dataProvider httpRequests + * + * @group network + */ + public function testHttpRequestCurlCAInfo($url, $method, $return_only_status, $expected) + { + if (! function_exists('curl_init')) { + $this->markTestSkipped('curl not supported'); + } + $result = PMA\libraries\Util::httpRequestCurl($url, $method, $return_only_status, null, '', CURLOPT_CAINFO); + $this->validateHttp($result, $expected); + } + /** * Test for http request using fopen *