diff options
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 27 |
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 | ?> | ||