Skip to content

Commit

Permalink
Update test to use request->env() instead of modifying globals.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 4, 2014
1 parent 610f3a0 commit 39aaadf
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions tests/TestCase/Network/RequestTest.php
Expand Up @@ -698,36 +698,27 @@ public function testMagicCallExceptionOnUnknownMethod() {
* @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'));
}

Expand Down

0 comments on commit 39aaadf

Please sign in to comment.