Browse Source

Update test to use request->env() instead of modifying globals.

ADmad 11 years ago
parent
commit
39aaadfb64
1 changed files with 8 additions and 17 deletions
  1. 8 17
      tests/TestCase/Network/RequestTest.php

+ 8 - 17
tests/TestCase/Network/RequestTest.php

@@ -698,36 +698,27 @@ class RequestTest extends TestCase {
  * @return void
  */
 	public function testIsSsl() {
-		$_SERVER['HTTPS'] = 1;
 		$request = new Request();
-		$this->assertTrue($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = 'on';
-		$request = new Request();
+		$request->env('HTTPS', 1);
 		$this->assertTrue($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = '1';
-		$request = new Request();
+		$request->env('HTTPS', 'on');
 		$this->assertTrue($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = 'I am not empty';
-		$request = new Request();
+		$request->env('HTTPS', '1');
 		$this->assertTrue($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = 1;
-		$request = new Request();
-		$this->assertTrue($request->is('ssl'));
+		$request->env('HTTPS', 'I am not empty');
+		$this->assertFalse($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = 'off';
-		$request = new Request();
+		$request->env('HTTPS', 'off');
 		$this->assertFalse($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = false;
-		$request = new Request();
+		$request->env('HTTPS', false);
 		$this->assertFalse($request->is('ssl'));
 
-		$_SERVER['HTTPS'] = '';
-		$request = new Request();
+		$request->env('HTTPS', '');
 		$this->assertFalse($request->is('ssl'));
 	}