From 869e00a23b0400b9ad81c1130227cc4c29d6a38d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 17 Apr 2013 17:45:49 +0200 Subject: [ticket/11362] Move phpbb_clean_path into a simple filesystem service PHPBB3-11362 --- tests/filesystem/clean_path_test.php | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/filesystem/clean_path_test.php (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php new file mode 100644 index 0000000000..50951fc88c --- /dev/null +++ b/tests/filesystem/clean_path_test.php @@ -0,0 +1,48 @@ +filesystem = new phpbb_filesystem(); + } + + public function clean_path_data() + { + return array( + array('foo', 'foo'), + array('foo/bar', 'foo/bar'), + array('foo/bar/', 'foo/bar/'), + array('foo/./bar', 'foo/bar'), + array('foo/./././bar', 'foo/bar'), + array('foo/bar/.', 'foo/bar'), + array('./foo/bar', './foo/bar'), + array('../foo/bar', '../foo/bar'), + array('one/two/three', 'one/two/three'), + array('one/two/../three', 'one/three'), + array('one/../two/three', 'two/three'), + array('one/two/..', 'one'), + array('one/two/../', 'one/'), + array('one/two/../three/../four', 'one/four'), + array('one/two/three/../../four', 'one/four'), + ); + } + + /** + * @dataProvider clean_path_data + */ + public function test_clean_path($input, $expected) + { + $this->assertEquals($expected, $this->filesystem->clean_path($input)); + } +} -- cgit v1.2.1 From f30b87519e9ead41525e1979cbce874e8a84e2b8 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 9 Sep 2013 17:28:56 -0500 Subject: [ticket/11832] Inject dependencies for phpbb_get_web_root_path (also moving) Function moved from phpbb_get_web_root_path to filesystem::get_web_root_path PHPBB3-11832 --- tests/filesystem/clean_path_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 50951fc88c..88352838bb 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -14,7 +14,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new phpbb_filesystem(); + $this->filesystem = new phpbb_filesystem(__DIR__ . './../../phpBB/'); } public function clean_path_data() -- cgit v1.2.1 From aa710df2db2512f6065f91dcf8b5fc7d100edf41 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 13 Sep 2013 09:52:02 -0500 Subject: [ticket/11832] Create phpbb_symfony_request to handle initiating symfony_request Now symfony_request is also a service (removed the function phpbb_create_symfony_request). Inject symfony request into filesystem Cleanup for the tests PHPBB3-11832 --- tests/filesystem/clean_path_test.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 88352838bb..b79668fc33 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -14,7 +14,12 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new phpbb_filesystem(__DIR__ . './../../phpBB/'); + $this->filesystem = new phpbb_filesystem( + new phpbb_symfony_request( + new phpbb_mock_request() + ), + dirname(__FILE__) . './../../phpBB/' + ); } public function clean_path_data() -- cgit v1.2.1 From b4a374dc73eda55db1c67b87bd65a73f79411ef5 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 13 Sep 2013 10:58:03 -0500 Subject: [ticket/11832] Fix INCLUDE(JS/CSS) PHPBB3-11832 --- tests/filesystem/clean_path_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index b79668fc33..38ccf1b603 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -18,7 +18,8 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case new phpbb_symfony_request( new phpbb_mock_request() ), - dirname(__FILE__) . './../../phpBB/' + dirname(__FILE__) . './../../phpBB/', + 'php' ); } -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- tests/filesystem/clean_path_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 50951fc88c..fedadc103b 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -14,7 +14,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new phpbb_filesystem(); + $this->filesystem = new \phpbb\filesystem(); } public function clean_path_data() -- cgit v1.2.1 From 9d8ac2b0ceb24dd14df61d083505941afb1b52c4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 17:12:41 +0200 Subject: [ticket/11700] Fix unit tests after develop merge PHPBB3-11700 --- tests/filesystem/clean_path_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 7fefcf2f90..5b9857ef2c 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -15,7 +15,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case { parent::setUp(); $this->filesystem = new \phpbb\filesystem( - new \phpbb\symfony\request( + new \phpbb\symfony_request( new phpbb_mock_request() ), dirname(__FILE__) . './../../phpBB/', -- cgit v1.2.1 From 7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 26 Sep 2013 15:34:44 +0200 Subject: [ticket/11852] Split filesystem and path_helper into 2 classes PHPBB3-11852 --- tests/filesystem/clean_path_test.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 5b9857ef2c..fedadc103b 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -14,13 +14,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new \phpbb\filesystem( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - dirname(__FILE__) . './../../phpBB/', - 'php' - ); + $this->filesystem = new \phpbb\filesystem(); } public function clean_path_data() -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- tests/filesystem/clean_path_test.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index fedadc103b..1aef0d8a0c 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From 41e52d9c9d3add473f46c6cc12d3fc208516d581 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 May 2014 20:04:16 +0200 Subject: [ticket/12099] Break clean_path tests with a simple test PHPBB3-12099 --- tests/filesystem/clean_path_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/filesystem/clean_path_test.php') diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 1aef0d8a0c..c585b17155 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -32,6 +32,8 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case array('foo/bar/.', 'foo/bar'), array('./foo/bar', './foo/bar'), array('../foo/bar', '../foo/bar'), + array('./../foo/bar', './../foo/bar'), + array('././../foo/bar', './../foo/bar'), array('one/two/three', 'one/two/three'), array('one/two/../three', 'one/three'), array('one/../two/three', 'two/three'), -- cgit v1.2.1