]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/http/HttpUtils/IsHttpsTest.php
3 namespace Shaarli\Http
;
5 require_once 'application/http/HttpUtils.php';
10 * Test class for is_https() function.
12 class IsHttpsTest
extends \Shaarli\TestCase
16 * Test is_https with HTTPS values.
18 public function testIsHttpsTrue()
20 $this->assertTrue(is_https(['HTTPS' => true]));
21 $this->assertTrue(is_https(['HTTPS' => '1']));
22 $this->assertTrue(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => 443]));
23 $this->assertTrue(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => '443']));
24 $this->assertTrue(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => '443,123,456,']));
28 * Test is_https with HTTP values.
30 public function testIsHttpsFalse()
32 $this->assertFalse(is_https([]));
33 $this->assertFalse(is_https(['HTTPS' => false]));
34 $this->assertFalse(is_https(['HTTPS' => '0']));
35 $this->assertFalse(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => 123]));
36 $this->assertFalse(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => '123']));
37 $this->assertFalse(is_https(['HTTPS' => false, 'HTTP_X_FORWARDED_PORT' => ',123,456,']));