aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions/is_absolute_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-05-14 15:54:40 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-05-14 18:27:09 +0200
commit3f75534258144dc0cdafd0e56c712b2b620b9e38 (patch)
treee8c2a02fba07ef50e321d4878e4f9926de73e0dc /tests/functions/is_absolute_test.php
parentb3479869232fd4f2e6c3f43e0d6e76ee08ab7d23 (diff)
downloadforums-3f75534258144dc0cdafd0e56c712b2b620b9e38.tar
forums-3f75534258144dc0cdafd0e56c712b2b620b9e38.tar.gz
forums-3f75534258144dc0cdafd0e56c712b2b620b9e38.tar.bz2
forums-3f75534258144dc0cdafd0e56c712b2b620b9e38.tar.xz
forums-3f75534258144dc0cdafd0e56c712b2b620b9e38.zip
[ticket/11540] Add unit tests for is_absolute()
PHPBB3-11540
Diffstat (limited to 'tests/functions/is_absolute_test.php')
-rw-r--r--tests/functions/is_absolute_test.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/functions/is_absolute_test.php b/tests/functions/is_absolute_test.php
new file mode 100644
index 0000000000..26425d2a36
--- /dev/null
+++ b/tests/functions/is_absolute_test.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_functions_is_absolute_test extends phpbb_test_case
+{
+ static public function is_absolute_data()
+ {
+ return array(
+ array('/etc/phpbb', true),
+ array('etc/phpbb', false),
+
+ // Until we got DIRECTORY_SEPARATOR replaced in that function,
+ // test results vary on OS.
+ array('c:\windows', DIRECTORY_SEPARATOR == '\\'),
+ array('C:\Windows', DIRECTORY_SEPARATOR == '\\'),
+ );
+ }
+
+ /**
+ * @dataProvider is_absolute_data
+ */
+ public function test_is_absolute($path, $expected)
+ {
+ $this->assertEquals($expected, is_absolute($path));
+ }
+}