summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/Web/THttpRequestTest.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/Web/THttpRequestTest.php b/tests/unit/Web/THttpRequestTest.php
index c71eb9b8..f44c5842 100644
--- a/tests/unit/Web/THttpRequestTest.php
+++ b/tests/unit/Web/THttpRequestTest.php
@@ -131,6 +131,11 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
self::assertEquals('GET', $request->getRequestType());
}
+ public function testGetForceSecureConnection() {
+ $request = new THttpRequest();
+ self::assertEquals(null,$request->getForceSecureConnection());
+ }
+
public function testGetIsSecureConnection() {
$request = new THttpRequest();
self::assertEquals(false, $request->getIsSecureConnection());
@@ -294,6 +299,15 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
$request->init (null);
self::assertEquals($_ENV, $request->getEnvironmentVariables());
}
+
+ public function testSetForceSecureConnection() {
+ $request = new THttpRequest();
+ $request->init(null);
+ $request->setForceSecureConnection(false);
+ self::assertEquals(false,$request->getForceSecureConnection());
+ $request->setForceSecureConnection(true);
+ self::assertEquals(true,$request->getForceSecureConnection());
+ }
public function testConstructUrl() {
$request = new THttpRequest ();
@@ -304,6 +318,14 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
// Try without encode &
$url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false);
self::assertEquals('/demos/personal/index.php?page=Home&param1=value1&param2=value2', $url);
+ // Try with ForceSecureConnection = true
+ $request->setForceSecureConnection(true);
+ $url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false);
+ self::assertEquals('https', substr($url,0,5));
+ // Try with ForceSecureConnection = false
+ $request->setForceSecureConnection(false);
+ $url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false);
+ self::assertEquals('http',substr($url,0,4));
}
public function testSetServiceID() {