summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarl <>2007-08-04 16:53:04 +0000
committercarl <>2007-08-04 16:53:04 +0000
commit2cc3a843fa2b31508737c2f51a34af24bf991256 (patch)
tree90699a2f9796db2801a7c1da105037ada669355a
parent8c964555633510dd85def6836f4b720366dce5ef (diff)
added unit test to ForceSecureConnection on THttpRequest
-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() {