From 869e00a23b0400b9ad81c1130227cc4c29d6a38d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 17 Apr 2013 17:45:49 +0200 Subject: [PATCH] [ticket/11362] Move phpbb_clean_path into a simple filesystem service PHPBB3-11362 --- phpBB/config/services.yml | 4 ++ phpBB/includes/filesystem.php | 52 +++++++++++++++++++ phpBB/includes/functions.php | 30 ----------- .../clean_path_test.php | 20 ++++--- 4 files changed, 68 insertions(+), 38 deletions(-) create mode 100644 phpBB/includes/filesystem.php rename tests/{functions => filesystem}/clean_path_test.php (71%) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index b9c71844dc..5febe76c49 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -142,9 +142,13 @@ services: - @ext.manager - %core.root_path% - @cache.driver + - @filesystem - .%core.php_ext% - _ext_finder + filesystem: + class: phpbb_filesystem + groupposition.legend: class: phpbb_groupposition_legend arguments: diff --git a/phpBB/includes/filesystem.php b/phpBB/includes/filesystem.php new file mode 100644 index 0000000000..27cab48fb0 --- /dev/null +++ b/phpBB/includes/filesystem.php @@ -0,0 +1,52 @@ +filesystem = new phpbb_filesystem(); + } + + public function clean_path_data() { return array( array('foo', 'foo'), @@ -33,12 +39,10 @@ class phpbb_clean_path_test extends phpbb_test_case } /** - * @dataProvider clean_path_test_data + * @dataProvider clean_path_data */ public function test_clean_path($input, $expected) { - $output = phpbb_clean_path($input); - - $this->assertEquals($expected, $output); + $this->assertEquals($expected, $this->filesystem->clean_path($input)); } }