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 --- phpBB/app.php | 1 + phpBB/common.php | 19 +-- phpBB/config/services.yml | 16 ++- phpBB/includes/bbcode.php | 4 +- phpBB/includes/functions.php | 27 ++-- phpBB/includes/functions_content.php | 4 +- phpBB/includes/functions_messenger.php | 4 +- phpBB/install/index.php | 4 +- phpBB/phpbb/filesystem.php | 145 --------------------- phpBB/phpbb/template/asset.php | 10 +- phpBB/phpbb/template/twig/environment.php | 22 ++-- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/twig.php | 22 ++-- tests/controller/helper_url_test.php | 10 +- tests/dbal/migrator_test.php | 8 +- tests/extension/manager_test.php | 8 +- tests/extension/metadata_manager_test.php | 11 +- tests/filesystem/clean_path_test.php | 8 +- tests/filesystem/web_root_path_test.php | 12 +- tests/mock/extension_manager.php | 8 +- tests/template/template_events_test.php | 5 +- tests/template/template_includecss_test.php | 4 +- tests/template/template_includejs_test.php | 26 ++-- tests/template/template_test_case.php | 5 +- tests/template/template_test_case_with_tree.php | 5 +- .../test_framework/phpbb_functional_test_case.php | 8 +- 26 files changed, 108 insertions(+), 290 deletions(-) diff --git a/phpBB/app.php b/phpBB/app.php index f1023ff1b5..7dc778e3a8 100644 --- a/phpBB/app.php +++ b/phpBB/app.php @@ -25,6 +25,7 @@ $auth->acl($user->data); $user->setup('app'); $http_kernel = $phpbb_container->get('http_kernel'); +$symfony_request = $phpbb_container->get('symfony_request'); $response = $http_kernel->handle($symfony_request); $response->send(); $http_kernel->terminate($symfony_request, $response); diff --git a/phpBB/common.php b/phpBB/common.php index 80375f7a9c..6bb3509ea1 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -47,19 +47,7 @@ if (!defined('PHPBB_INSTALLED')) // Eliminate . and .. from the path require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); - require($phpbb_root_path . 'phpbb/symfony_request.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/deactivated_super_global.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/type_cast_helper_interface.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/type_cast_helper.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/request_interface.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/request.' . $phpEx); - $phpbb_filesystem = new phpbb\filesystem( - new phpbb\symfony_request( - new phpbb\request\request() - ), - $phpbb_root_path, - $phpEx - ); + $phpbb_filesystem = new phpbb\filesystem(); $script_path = $phpbb_filesystem->clean_path($script_path); $url = (($secure) ? 'https://' : 'http://') . $server_name; @@ -121,16 +109,13 @@ $db = $phpbb_container->get('dbal.conn'); // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -// Create a Symfony Request object from our phpbb_request object -$symfony_request = $phpbb_container->get('symfony_request'); -$phpbb_filesystem = $phpbb_container->get('filesystem'); - // Grab global variables, re-cache if necessary $config = $phpbb_container->get('config'); set_config(null, null, null, $config); set_config_count(null, null, null, $config); $phpbb_log = $phpbb_container->get('log'); +$phpbb_path_helper = $phpbb_container->get('path_helper'); // load extensions $phpbb_extension_manager = $phpbb_container->get('ext.manager'); diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index e33db0c2bc..51ae5c454d 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -169,11 +169,6 @@ services: filesystem: class: phpbb\filesystem - arguments: - - @symfony_request - - %core.root_path% - - %core.php_ext% - - %core.adm_relative_path% groupposition.legend: class: phpbb\groupposition\legend @@ -251,6 +246,15 @@ services: - %tables.notifications% - %tables.user_notifications% + path_helper: + class: phpbb\path_helper + arguments: + - @symfony_request + - @filesystem + - %core.root_path% + - %core.php_ext% + - %core.adm_relative_path% + php_ini: class: phpbb\php\ini @@ -265,7 +269,7 @@ services: template: class: phpbb\template\twig\twig arguments: - - @filesystem + - @path_helper - @config - @user - @template_context diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index cd2ca7ffce..c4076a0120 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -126,13 +126,13 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_filesystem; + global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); + $template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b3e50847fd..28c03534ea 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1056,31 +1056,32 @@ else */ function phpbb_clean_path($path) { - global $phpbb_container; + global $phpbb_path_helper, $phpbb_container; - if ($phpbb_container) + if (!$phpbb_path_helper && $phpbb_container) { - $phpbb_filesystem = $phpbb_container->get('filesystem'); + $phpbb_path_helper = $phpbb_container->get('path_helper'); } - else + else if (!$phpbb_path_helper) { // The container is not yet loaded, use a new instance - if (!class_exists('\phpbb\filesystem')) + if (!class_exists('\phpbb\path_helper')) { global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); } - $phpbb_filesystem = new phpbb\filesystem( + $phpbb_path_helper = new phpbb\path_helper( new phpbb\symfony_request( new phpbb\request\request() ), + new phpbb\filesystem(), $phpbb_root_path, $phpEx ); } - return $phpbb_filesystem->clean_path($path); + return $phpbb_path_helper->clean_path($path); } // functions used for building option fields @@ -2445,7 +2446,7 @@ function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $star */ function append_sid($url, $params = false, $is_amp = true, $session_id = false) { - global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem; + global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; global $phpbb_dispatcher; if ($params === '' || (is_array($params) && empty($params))) @@ -2455,9 +2456,9 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) } // Update the root path with the correct relative web path - if ($phpbb_filesystem instanceof \phpbb\filesystem) + if ($phpbb_path_helper instanceof \phpbb\path_helper) { - $url = $phpbb_filesystem->update_web_root_path($url); + $url = $phpbb_path_helper->update_web_root_path($url); } $append_sid_overwrite = false; @@ -5276,8 +5277,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // This path is sent with the base template paths in the assign_vars() // call below. We need to correct it in case we are accessing from a // controller because the web paths will be incorrect otherwise. - $phpbb_filesystem = $phpbb_container->get('filesystem'); - $corrected_path = $phpbb_filesystem->get_web_root_path(); + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; // Send a proper content-language to the output diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 7ecc99b39c..863450a4b2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -834,7 +834,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_filesystem; + global $config, $user, $phpbb_path_helper; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -842,7 +842,7 @@ function smiley_text($text, $force_option = false) } else { - $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_filesystem->get_web_root_path(); + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); return preg_replace('#write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_filesystem());\n") + ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper());\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 2da7405743..9df9310427 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -33,10 +33,10 @@ class twig extends \phpbb\template\base private $cachepath = ''; /** - * phpBB filesystem - * @var \phpbb\filesystem + * phpBB path helper + * @var \phpbb\path_helper */ - protected $phpbb_filesystem; + protected $path_helper; /** * phpBB root path @@ -79,17 +79,17 @@ class twig extends \phpbb\template\base /** * Constructor. * - * @param \phpbb\filesystem $phpbb_filesystem + * @param \phpbb\path_helper $path_helper * @param \phpbb\config\config $config * @param \phpbb\user $user * @param \phpbb\template\context $context template context * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked */ - public function __construct(\phpbb\filesystem $phpbb_filesystem, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) + public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) { - $this->phpbb_filesystem = $phpbb_filesystem; - $this->phpbb_root_path = $phpbb_filesystem->get_phpbb_root_path(); - $this->php_ext = $phpbb_filesystem->get_php_ext(); + $this->path_helper = $path_helper; + $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); + $this->php_ext = $path_helper->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; @@ -103,7 +103,7 @@ class twig extends \phpbb\template\base $this->twig = new \phpbb\template\twig\environment( $this->config, ($this->extension_manager) ? $this->extension_manager->all_enabled() : array(), - $this->phpbb_filesystem, + $this->path_helper, $loader, array( 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath, @@ -125,9 +125,9 @@ class twig extends \phpbb\template\base $this->twig->setLexer($lexer); // Add admin namespace - if ($this->phpbb_filesystem->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/')) + if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/', 'admin'); + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin'); } } 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( - '', - '', + '', + '', ); // 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), - '', + '', ), array( array('TEST' => 2), - '', + '', ), array( array('TEST' => 3), - '', + '', ), array( array('TEST' => 4), - '', + '', ), array( array('TEST' => 6), - '', + '', ), array( array('TEST' => 7), - '', + '', ), array( array('TEST' => 8), - '', + '', ), array( array('TEST' => 9), - '', + '', ), array( array('TEST' => 10), - '', + '', ), array( array('TEST' => 11), - '', + '', ), array( array('TEST' => 12), - '', + '', ), array( array('TEST' => 14), - '', + '', ), array( array('TEST' => 15), @@ -84,7 +84,7 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 18), - '', + '', ), ); } 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, -- cgit v1.2.1