aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/http/HttpUtils/IsHttpsTest.php
diff options
context:
space:
mode:
authorAurélien Tamisier <virtualtam+github@flibidi.net>2019-01-18 21:26:03 +0100
committerGitHub <noreply@github.com>2019-01-18 21:26:03 +0100
commitff3b5dc5542ec150f0d9b447394364a15e9156d0 (patch)
tree5e926e36816d510e3b3a10e20b94c23f43b55092 /tests/http/HttpUtils/IsHttpsTest.php
parent1826e383ecf501302974132fd443cf1ca06e10f6 (diff)
parentdea72c711ff740b3b829d238fcf85648465143a0 (diff)
downloadShaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.tar.gz
Shaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.tar.zst
Shaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.zip
Merge pull request #1248 from virtualtam/refactor/namespacing
Ensure all PHP classes are properly namespaced
Diffstat (limited to 'tests/http/HttpUtils/IsHttpsTest.php')
-rw-r--r--tests/http/HttpUtils/IsHttpsTest.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/http/HttpUtils/IsHttpsTest.php b/tests/http/HttpUtils/IsHttpsTest.php
new file mode 100644
index 00000000..348956c6
--- /dev/null
+++ b/tests/http/HttpUtils/IsHttpsTest.php
@@ -0,0 +1,39 @@
1<?php
2
3namespace Shaarli\Http;
4
5require_once 'application/http/HttpUtils.php';
6
7/**
8 * Class IsHttpsTest
9 *
10 * Test class for is_https() function.
11 */
12class IsHttpsTest extends \PHPUnit\Framework\TestCase
13{
14
15 /**
16 * Test is_https with HTTPS values.
17 */
18 public function testIsHttpsTrue()
19 {
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,']));
25 }
26
27 /**
28 * Test is_https with HTTP values.
29 */
30 public function testIsHttpsFalse()
31 {
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,']));
38 }
39}