Skip to content

Commit c2db98c

Browse files
authored
Merge pull request php-curl-class#580 from zachborboa/master
Fix implementation of Curl::setProxyAuth
2 parents c7eb389 + 62d5390 commit c2db98c

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/Curl/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ public function setProxy($proxy, $port = null, $username = null, $password = nul
10701070
*/
10711071
public function setProxyAuth($auth)
10721072
{
1073-
$this-setOpt(CURLOPT_PROXYAUTH, $auth);
1073+
$this->setOpt(CURLOPT_PROXYAUTH, $auth);
10741074
}
10751075

10761076
/**

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,6 +3767,36 @@ public function testProxySettings()
37673767
$this->assertNull($curl->getOpt(CURLOPT_PROXY));
37683768
}
37693769

3770+
public function testSetProxyAuth()
3771+
{
3772+
$auth = CURLAUTH_BASIC;
3773+
3774+
$curl = new Curl();
3775+
$this->assertNull($curl->getOpt(CURLOPT_PROXYAUTH));
3776+
$curl->setProxyAuth($auth);
3777+
$this->assertEquals($auth, $curl->getOpt(CURLOPT_PROXYAUTH));
3778+
}
3779+
3780+
public function testSetProxyType()
3781+
{
3782+
$type = CURLPROXY_SOCKS5;
3783+
3784+
$curl = new Curl();
3785+
$this->assertNull($curl->getOpt(CURLOPT_PROXYTYPE));
3786+
$curl->setProxyType($type);
3787+
$this->assertEquals($type, $curl->getOpt(CURLOPT_PROXYTYPE));
3788+
}
3789+
3790+
public function testSetProxyTunnel()
3791+
{
3792+
$tunnel = true;
3793+
3794+
$curl = new Curl();
3795+
$this->assertNull($curl->getOpt(CURLOPT_HTTPPROXYTUNNEL));
3796+
$curl->setProxyTunnel($tunnel);
3797+
$this->assertEquals($tunnel, $curl->getOpt(CURLOPT_HTTPPROXYTUNNEL));
3798+
}
3799+
37703800
public function testJsonSerializable()
37713801
{
37723802
if (!interface_exists('JsonSerializable')) {

0 commit comments

Comments
 (0)