Skip to content
Permalink
Browse files

Test case for proxy authentication when request is HTTPS

  • Loading branch information...
RichieB2B committed Dec 12, 2015
1 parent ac50b60 commit 077f157adf9526bee8c5ffde4ecf3e2d83e51c4c
Showing with 40 additions and 0 deletions.
  1. +40 −0 lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
@@ -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
*
@@ -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.
You can’t perform that action at this time.