aboutsummaryrefslogtreecommitdiffstats
path: root/tests/path_helper/path_helper_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-11 15:36:26 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-05-29 23:44:09 +0200
commitb8f3972afaca9701defb0f719ef668c9bab5d5ca (patch)
treeacb242260d90a76eba1505cb34071ac6ca66a976 /tests/path_helper/path_helper_test.php
parent58cfdfe14386e48047f3620d1c09218fdbaac5f0 (diff)
downloadforums-b8f3972afaca9701defb0f719ef668c9bab5d5ca.tar
forums-b8f3972afaca9701defb0f719ef668c9bab5d5ca.tar.gz
forums-b8f3972afaca9701defb0f719ef668c9bab5d5ca.tar.bz2
forums-b8f3972afaca9701defb0f719ef668c9bab5d5ca.tar.xz
forums-b8f3972afaca9701defb0f719ef668c9bab5d5ca.zip
[ticket/12099] Clean paths in tests
PHPBB3-12099
Diffstat (limited to 'tests/path_helper/path_helper_test.php')
-rw-r--r--tests/path_helper/path_helper_test.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php
index d4bcce31b2..4eac2f567b 100644
--- a/tests/path_helper/path_helper_test.php
+++ b/tests/path_helper/path_helper_test.php
@@ -21,7 +21,8 @@ class phpbb_path_helper_test extends phpbb_test_case
{
parent::setUp();
- $this->set_phpbb_root_path();
+ $filesystem = new \phpbb\filesystem();
+ $this->set_phpbb_root_path($filesystem);
$this->path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
@@ -41,9 +42,9 @@ class phpbb_path_helper_test extends phpbb_test_case
* any time we wish to use it in one of these functions (and
* also in general for everything else)
*/
- public function set_phpbb_root_path()
+ public function set_phpbb_root_path($filesystem)
{
- $this->phpbb_root_path = dirname(__FILE__) . '/../../phpBB/';
+ $this->phpbb_root_path = $filesystem->clean_path(dirname(__FILE__) . '/../../phpBB/');
}
public function test_get_web_root_path()
@@ -54,7 +55,8 @@ class phpbb_path_helper_test extends phpbb_test_case
public function basic_update_web_root_path_data()
{
- $this->set_phpbb_root_path();
+ $filesystem = new \phpbb\filesystem();
+ $this->set_phpbb_root_path($filesystem);
return array(
array(
@@ -72,7 +74,7 @@ class phpbb_path_helper_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',
+ $filesystem->clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'),
),
);
}
@@ -87,43 +89,43 @@ class phpbb_path_helper_test extends phpbb_test_case
public function update_web_root_path_data()
{
- $this->set_phpbb_root_path();
+ $this->set_phpbb_root_path(new \phpbb\filesystem());
return array(
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',
+ '../../',
'/foo/template',
'/phpbb3-fork/phpBB/app.php/foo/template',
'/phpbb3-fork/phpBB/app.php',
),
array(
$this->phpbb_root_path . 'test.php',
- $this->phpbb_root_path . '../test.php',
+ '../',
'/foo/template',
'/phpbb3-fork/phpBB/foo/template',
'/phpbb3-fork/phpBB/app.php',
),
array(
$this->phpbb_root_path . 'test.php',
- $this->phpbb_root_path . '../test.php',
+ '../',
'/',
'/phpbb3-fork/phpBB/app.php/',
'/phpbb3-fork/phpBB/app.php',
@@ -134,7 +136,7 @@ class phpbb_path_helper_test extends phpbb_test_case
/**
* @dataProvider update_web_root_path_data
*/
- public function test_update_web_root_path($input, $expected, $getPathInfo, $getRequestUri = null, $getScriptName = null)
+ public function test_update_web_root_path($input, $correction, $getPathInfo, $getRequestUri = null, $getScriptName = null)
{
$symfony_request = $this->getMock('\phpbb\symfony_request', array(), array(
new phpbb_mock_request(),
@@ -156,7 +158,7 @@ class phpbb_path_helper_test extends phpbb_test_case
'php'
);
- $this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request));
+ $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request));
}
public function clean_url_data()