diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-09-26 15:34:44 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-09-26 15:34:44 +0200 |
commit | 7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e (patch) | |
tree | 9a7cf0bb2f985be79c51d4d0a1743a90b5532404 /tests | |
parent | e8303bc3199081d1f9f0679d3b98298ccdc49deb (diff) | |
download | forums-7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e.tar forums-7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e.tar.gz forums-7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e.tar.bz2 forums-7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e.tar.xz forums-7525c49d454e1ff4a156709ea9ecc1dc0b28dd6e.zip |
[ticket/11852] Split filesystem and path_helper into 2 classes
PHPBB3-11852
Diffstat (limited to 'tests')
-rw-r--r-- | tests/controller/helper_url_test.php | 10 | ||||
-rw-r--r-- | tests/dbal/migrator_test.php | 8 | ||||
-rw-r--r-- | tests/extension/manager_test.php | 8 | ||||
-rw-r--r-- | tests/extension/metadata_manager_test.php | 11 | ||||
-rw-r--r-- | tests/filesystem/clean_path_test.php | 8 | ||||
-rw-r--r-- | tests/filesystem/web_root_path_test.php | 12 | ||||
-rw-r--r-- | tests/mock/extension_manager.php | 8 | ||||
-rw-r--r-- | tests/template/template_events_test.php | 5 | ||||
-rw-r--r-- | tests/template/template_includecss_test.php | 4 | ||||
-rw-r--r-- | tests/template/template_includejs_test.php | 26 | ||||
-rw-r--r-- | tests/template/template_test_case.php | 5 | ||||
-rw-r--r-- | tests/template/template_test_case_with_tree.php | 5 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 8 |
13 files changed, 45 insertions, 73 deletions
diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 4ea177074f..33fc6c4f1b 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -49,14 +49,15 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $this->user = $this->getMock('\phpbb\user'); - $phpbb_filesystem = new \phpbb\filesystem( + $phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); - $this->template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context()); + $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $this->user, new \phpbb\template\context()); // We don't use mod_rewrite in these tests $config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); @@ -101,14 +102,15 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $this->user = $this->getMock('\phpbb\user'); - $phpbb_filesystem = new \phpbb\filesystem( + $phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); - $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context()); + $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $this->user, new \phpbb\template\context()); $config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index ef5d167fc2..c6b4c289d3 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -59,13 +59,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $container, $this->db, $this->config, - new phpbb\filesystem( - new phpbb\symfony_request( - new phpbb_mock_request() - ), - dirname(__FILE__) . '/../../phpBB/', - 'php' - ), + new phpbb\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/../../phpBB/', 'php', diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index c4a32f53ab..b127daf2ed 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -114,13 +114,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $container, $db, $config, - new \phpbb\filesystem( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - $phpbb_root_path, - $php_ext - ), + new \phpbb\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/', $php_ext, diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 2b27a1bae2..242ec38908 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -41,10 +41,11 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->table_prefix = 'phpbb_'; $this->template = new \phpbb\template\twig\twig( - new \phpbb\filesystem( + new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $this->phpbb_root_path, $this->phpEx ), @@ -70,13 +71,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $container, $this->db, $this->config, - new \phpbb\filesystem( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - $this->phpbb_root_path, - $this->phpEx - ), + new \phpbb\filesystem(), 'phpbb_ext', $this->phpbb_root_path, $this->phpEx, 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() diff --git a/tests/filesystem/web_root_path_test.php b/tests/filesystem/web_root_path_test.php index e0f716cdae..ebc99669ce 100644 --- a/tests/filesystem/web_root_path_test.php +++ b/tests/filesystem/web_root_path_test.php @@ -18,10 +18,11 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case $this->set_phpbb_root_path(); - $this->filesystem = new \phpbb\filesystem( + $this->path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $this->phpbb_root_path, 'php' ); @@ -43,7 +44,7 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case public function test_get_web_root_path() { // Symfony Request = null, so always should return phpbb_root_path - $this->assertEquals($this->phpbb_root_path, $this->filesystem->get_web_root_path()); + $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); } public function basic_update_web_root_path_data() @@ -71,7 +72,7 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case */ public function test_basic_update_web_root_path($input, $expected) { - $this->assertEquals($expected, $this->filesystem->update_web_root_path($input, $symfony_request)); + $this->assertEquals($expected, $this->path_helper->update_web_root_path($input, $symfony_request)); } public function update_web_root_path_data() @@ -131,12 +132,13 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case ->method('getScriptName') ->will($this->returnValue($getScriptName)); - $filesystem = new \phpbb\filesystem( + $path_helper = new \phpbb\path_helper( $symfony_request, + new \phpbb\filesystem(), $this->phpbb_root_path, 'php' ); - $this->assertEquals($expected, $filesystem->update_web_root_path($input, $symfony_request)); + $this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request)); } } diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 0c6b8447f1..7049cbdc50 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -14,12 +14,6 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = 'php'; $this->extensions = $extensions; - $this->filesystem = new \phpbb\filesystem( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - $this->phpbb_root_path, - $this->php_ext - ); + $this->filesystem = new \phpbb\filesystem(); } } diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 4155d5fd83..41e00e86a7 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -116,14 +116,15 @@ Zeta test event in all', $this->extension_manager = new phpbb_mock_filesystem_extension_manager( dirname(__FILE__) . "/datasets/$dataset/" ); - $phpbb_filesystem = new \phpbb\filesystem( + $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); - $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context, $this->extension_manager); + $this->template = new \phpbb\template\twig\twig($path_helper, $config, $user, new \phpbb\template\context, $this->extension_manager); $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path)); } } diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index c00aa8e9bb..7424af0c93 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -18,8 +18,8 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te // Prepare correct result $scripts = array( - '<link href="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', - '<link href="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', + '<link href="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', ); // Run test diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 2faeb5fcaa..ab0f4b9ca1 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -24,51 +24,51 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes */ array( array('TEST' => 1), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=1"></script>', ), array( array('TEST' => 2), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=0"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=0"></script>', ), array( array('TEST' => 3), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&assets_version=0"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( array('TEST' => 4), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&assets_version=0"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( array('TEST' => 6), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?assets_version=1"></script>', ), array( array('TEST' => 7), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/child_only.js?assets_version=1"></script>', ), array( array('TEST' => 8), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>', ), array( array('TEST' => 9), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>', ), array( array('TEST' => 10), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>', ), array( array('TEST' => 11), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.js?test1=1&test2=2&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/child_only.js?test1=1&test2=2&assets_version=1#test3"></script>', ), array( array('TEST' => 12), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1=1&test2=2&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1=1&test2=2&assets_version=1#test3"></script>', ), array( array('TEST' => 14), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1="&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1="&assets_version=1#test3"></script>', ), array( array('TEST' => 15), @@ -84,7 +84,7 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 18), - '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&test2=0&assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->phpbb_path_helper->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&test2=0&assets_version=1"></script>', ), ); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index e9cbdec1d9..c75b1e5065 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -63,16 +63,17 @@ class phpbb_template_template_test_case extends phpbb_test_case $config = new \phpbb\config\config(array_merge($defaults, $new_config)); $this->user = new \phpbb\user; - $phpbb_filesystem = new \phpbb\filesystem( + $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); $this->template_path = $this->test_path . '/templates'; - $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context()); + $this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, new \phpbb\template\context()); $this->template->set_custom_style('tests', $this->template_path); } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 232331d37c..e614c42d73 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -18,17 +18,18 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $defaults = $this->config_defaults(); $config = new \phpbb\config\config(array_merge($defaults, $new_config)); - $this->phpbb_filesystem = new \phpbb\filesystem( + $this->phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), + new \phpbb\filesystem(), $phpbb_root_path, $phpEx ); $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $this->template = new phpbb\template\twig\twig($this->phpbb_filesystem, $config, $user, new phpbb\template\context()); + $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $user, new phpbb\template\context()); $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index f87b3538a1..a0d186e0f2 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -203,13 +203,7 @@ class phpbb_functional_test_case extends phpbb_test_case $container, $db, $config, - new phpbb\filesystem( - new phpbb\symfony_request( - new phpbb_mock_request() - ), - $phpbb_root_path, - $php_ext - ), + new phpbb\filesystem(), self::$config['table_prefix'] . 'ext', dirname(__FILE__) . '/', $php_ext, |