Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test case for proxy authentication when request is HTTPS
  • Loading branch information
RichieB2B committed Dec 12, 2015
1 parent ac50b60 commit 077f157
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
Expand Up @@ -19,6 +19,24 @@
App::uses('HttpSocket', 'Network/Http');
App::uses('BasicAuthentication', 'Network/Http');

/**
* class TestHttpSocket
*
* @package Cake.Test.Case.Network.Http
*/
class TestHttpSocket extends HttpSocket {

/**
* testSetProxy method
*
* @return void
*/
public function testSetProxy($proxy = null) {
$this->_proxy=$proxy;
$this->_setProxy();
}
}

/**
* BasicMethodTest class
*
Expand Down Expand Up @@ -60,4 +78,26 @@ public function testProxyAuthentication() {
$this->assertEquals('Basic bWFyazpzZWNyZXQ=', $http->request['header']['Proxy-Authorization']);
}

/**
* testProxyAuthenticationSsl method
*
* @return void
*/
public function testProxyAuthenticationSsl() {
$http = new TestHttpSocket();
$http->request['uri']['scheme'] = 'https';
$proxy = array(
'host' => 'localhost',
'port' => 3128,
'method' => 'Basic',
'user' => 'mark',
'pass' => 'secret'
);

$http->testSetProxy($proxy);

$this->assertEquals('Basic bWFyazpzZWNyZXQ=', $http->config['proxyauth']);
$this->assertFalse(isset($http->request['header']['Proxy-Authorization']));
}

}

0 comments on commit 077f157

Please sign in to comment.