Skip to content

Commit 494d8a7

Browse files
committed
Add additional tests for MultiCurl proxy functions
1 parent 8e5a0a2 commit 494d8a7

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

examples/multi_curl_proxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require __DIR__ . '/../vendor/autoload.php';
33

4-
use \Curl\Curl;
4+
use \Curl\MultiCurl;
55

66
$multi_curl = new MultiCurl();
77
$multi_curl->setProxy('someproxy.com', '9999', 'username', 'password');

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3779,7 +3779,7 @@ public function testSetProxyAuth()
37793779

37803780
public function testSetProxyType()
37813781
{
3782-
$type = CURLPROXY_SOCKS5;
3782+
$type = CURLPROXY_SOCKS5;
37833783

37843784
$curl = new Curl();
37853785
$this->assertNull($curl->getOpt(CURLOPT_PROXYTYPE));

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,4 +2889,34 @@ public function testProxySettings()
28892889
$multi_curl->unsetProxy();
28902890
$this->assertNull($multi_curl->getOpt(CURLOPT_PROXY));
28912891
}
2892+
2893+
public function testSetProxyAuth()
2894+
{
2895+
$auth = CURLAUTH_BASIC;
2896+
2897+
$multi_curl = new MultiCurl();
2898+
$this->assertNull($multi_curl->getOpt(CURLOPT_PROXYAUTH));
2899+
$multi_curl->setProxyAuth($auth);
2900+
$this->assertEquals($auth, $multi_curl->getOpt(CURLOPT_PROXYAUTH));
2901+
}
2902+
2903+
public function testSetProxyType()
2904+
{
2905+
$type = CURLPROXY_SOCKS5;
2906+
2907+
$multi_curl = new MultiCurl();
2908+
$this->assertNull($multi_curl->getOpt(CURLOPT_PROXYTYPE));
2909+
$multi_curl->setProxyType($type);
2910+
$this->assertEquals($type, $multi_curl->getOpt(CURLOPT_PROXYTYPE));
2911+
}
2912+
2913+
public function testSetProxyTunnel()
2914+
{
2915+
$tunnel = true;
2916+
2917+
$multi_curl = new MultiCurl();
2918+
$this->assertNull($multi_curl->getOpt(CURLOPT_HTTPPROXYTUNNEL));
2919+
$multi_curl->setProxyTunnel($tunnel);
2920+
$this->assertEquals($tunnel, $multi_curl->getOpt(CURLOPT_HTTPPROXYTUNNEL));
2921+
}
28922922
}

0 commit comments

Comments
 (0)