aboutsummaryrefslogtreecommitdiffstats
path: root/tests/filesystem
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-09-10 11:15:24 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-09-10 11:15:24 -0500
commit3a4efa79592616ac099e95d07e9aed52bc5a19a3 (patch)
tree5624e608cf442471a01445ed10a66a26a6fced04 /tests/filesystem
parentc46637990e5937881f98d9711783fe9982532884 (diff)
downloadforums-3a4efa79592616ac099e95d07e9aed52bc5a19a3.tar
forums-3a4efa79592616ac099e95d07e9aed52bc5a19a3.tar.gz
forums-3a4efa79592616ac099e95d07e9aed52bc5a19a3.tar.bz2
forums-3a4efa79592616ac099e95d07e9aed52bc5a19a3.tar.xz
forums-3a4efa79592616ac099e95d07e9aed52bc5a19a3.zip
[ticket/11832] More extensive testing
PHPBB3-11832
Diffstat (limited to 'tests/filesystem')
-rw-r--r--tests/filesystem/web_root_path_test.php49
1 files changed, 42 insertions, 7 deletions
diff --git a/tests/filesystem/web_root_path_test.php b/tests/filesystem/web_root_path_test.php
index 3c9637fe06..badc2fab58 100644
--- a/tests/filesystem/web_root_path_test.php
+++ b/tests/filesystem/web_root_path_test.php
@@ -18,9 +18,7 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
$this->set_phpbb_root_path();
- global $phpbb_filesystem;
-
- $phpbb_filesystem = $this->filesystem = new phpbb_filesystem($this->phpbb_root_path);
+ $this->filesystem = new phpbb_filesystem($this->phpbb_root_path);
}
/**
@@ -49,7 +47,6 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
return array(
array(
$this->phpbb_root_path . 'test.php',
- $this->phpbb_root_path . 'test.php',
),
array(
'test.php',
@@ -57,7 +54,28 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
),
array(
$this->phpbb_root_path . $this->phpbb_root_path . 'test.php',
- $this->phpbb_root_path . $this->phpbb_root_path . 'test.php',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . 'test.php',
+ '/',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . 'test.php',
+ '//',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../test.php',
+ '//',
+ 'foo/bar.php',
+ 'bar.php',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../../test.php',
+ '////',
),
);
}
@@ -65,8 +83,25 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
/**
* @dataProvider update_web_root_path_data
*/
- public function test_update_web_root_path($input, $expected)
+ public function test_update_web_root_path($input, $expected = null, $getPathInfo = null, $getRequestUri = null, $getScriptName = null)
{
- $this->assertEquals($expected, $this->filesystem->update_web_root_path($input));
+ $expected = ($expected === null) ? $input : $expected;
+
+ $symfony_request = null;
+ if ($getPathInfo !== null)
+ {
+ $symfony_request = $this->getMock("Symfony\Component\HttpFoundation\Request");
+ $symfony_request->expects($this->any())
+ ->method('getPathInfo')
+ ->will($this->returnValue($getPathInfo));
+ $symfony_request->expects($this->any())
+ ->method('getRequestUri')
+ ->will($this->returnValue($getRequestUri));
+ $symfony_request->expects($this->any())
+ ->method('getScriptName')
+ ->will($this->returnValue($getScriptName));
+ }
+
+ $this->assertEquals($expected, $this->filesystem->update_web_root_path($input, $symfony_request));
}
}