aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/UtilsTest.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-07-11 01:29:12 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-07-13 13:06:06 +0200
commitd1e2f8e52c931f84c11d4f54f32959710d528182 (patch)
treebe5ad2fcfeb31136e7afca0603a3cd3da3d76b57 /tests/UtilsTest.php
parent5b0ebbc5de06b8a0e9679b78b45d0dc755db7986 (diff)
downloadShaarli-d1e2f8e52c931f84c11d4f54f32959710d528182.tar.gz
Shaarli-d1e2f8e52c931f84c11d4f54f32959710d528182.tar.zst
Shaarli-d1e2f8e52c931f84c11d4f54f32959710d528182.zip
PHP: ensure 5.3 compatibility, refactor timezone utilities
Relates to #250 Modifications - supported version - bump required version from 5.1.0 to 5.3.x - update README - add PHP 5.3 to Travis environments - rewrite array declarations: explicitely use array() instead of [] - move checkPHPVersion to application/Utils.php - move timezone functions to application/TimeZone.php - cleanup code - improve test coverage Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r--tests/UtilsTest.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index 8355c7f8..28e15f5a 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -109,7 +109,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase
109 */ 109 */
110 public function testGenerateLocationLoop() { 110 public function testGenerateLocationLoop() {
111 $ref = 'http://localhost/?test'; 111 $ref = 'http://localhost/?test';
112 $this->assertEquals('?', generateLocation($ref, 'localhost', ['test'])); 112 $this->assertEquals('?', generateLocation($ref, 'localhost', array('test')));
113 } 113 }
114 114
115 /** 115 /**
@@ -119,4 +119,36 @@ class UtilsTest extends PHPUnit_Framework_TestCase
119 $ref = 'http://somewebsite.com/?test'; 119 $ref = 'http://somewebsite.com/?test';
120 $this->assertEquals('?', generateLocation($ref, 'localhost')); 120 $this->assertEquals('?', generateLocation($ref, 'localhost'));
121 } 121 }
122
123 /**
124 * Check supported PHP versions
125 */
126 public function testCheckSupportedPHPVersion()
127 {
128 $minVersion = '5.3';
129 checkPHPVersion($minVersion, '5.4.32');
130 checkPHPVersion($minVersion, '5.5');
131 checkPHPVersion($minVersion, '5.6.10');
132 }
133
134 /**
135 * Check a unsupported PHP version
136 * @expectedException Exception
137 * @expectedExceptionMessageRegExp /Your PHP version is obsolete/
138 */
139 public function testCheckSupportedPHPVersion51()
140 {
141 checkPHPVersion('5.3', '5.1.0');
142 }
143
144 /**
145 * Check another unsupported PHP version
146 * @expectedException Exception
147 * @expectedExceptionMessageRegExp /Your PHP version is obsolete/
148 */
149 public function testCheckSupportedPHPVersion52()
150 {
151 checkPHPVersion('5.3', '5.2');
152 }
122} 153}
154?>