aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorVirtualTam <tamisier.aurelien@gmail.com>2015-07-12 19:56:13 +0200
committerVirtualTam <tamisier.aurelien@gmail.com>2015-07-12 19:56:13 +0200
commit5b0ebbc5de06b8a0e9679b78b45d0dc755db7986 (patch)
treeed6a7f6c7ea02d0942d32c31637553976e978c5f /tests
parent1dcbe29611a4ba4b4b2d37954105c1fc8da33496 (diff)
parent775803a05cdba9d7fc1b37af4b15ecd80a8cbcc2 (diff)
downloadShaarli-5b0ebbc5de06b8a0e9679b78b45d0dc755db7986.tar.gz
Shaarli-5b0ebbc5de06b8a0e9679b78b45d0dc755db7986.tar.zst
Shaarli-5b0ebbc5de06b8a0e9679b78b45d0dc755db7986.zip
Merge pull request #257 from ArthurHoaro/tag-http-referer
Prevent redirection loop everytime we rely on HTTP_REFERER
Diffstat (limited to 'tests')
-rw-r--r--tests/UtilsTest.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index 90392dfb..8355c7f8 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -93,5 +93,30 @@ class UtilsTest extends PHPUnit_Framework_TestCase
93 $this->assertFalse(checkDateFormat('Y-m-d', '2015-06')); 93 $this->assertFalse(checkDateFormat('Y-m-d', '2015-06'));
94 $this->assertFalse(checkDateFormat('Ymd', 'DeLorean')); 94 $this->assertFalse(checkDateFormat('Ymd', 'DeLorean'));
95 } 95 }
96
97 /**
98 * Test generate location with valid data.
99 */
100 public function testGenerateLocation() {
101 $ref = 'http://localhost/?test';
102 $this->assertEquals($ref, generateLocation($ref, 'localhost'));
103 $ref = 'http://localhost:8080/?test';
104 $this->assertEquals($ref, generateLocation($ref, 'localhost:8080'));
105 }
106
107 /**
108 * Test generate location - anti loop.
109 */
110 public function testGenerateLocationLoop() {
111 $ref = 'http://localhost/?test';
112 $this->assertEquals('?', generateLocation($ref, 'localhost', ['test']));
113 }
114
115 /**
116 * Test generate location - from other domain.
117 */
118 public function testGenerateLocationOut() {
119 $ref = 'http://somewebsite.com/?test';
120 $this->assertEquals('?', generateLocation($ref, 'localhost'));
121 }
96} 122}
97?>