From 7a310cc7d9b1ba2ac92ad2939df60754e124d79d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 4 Mar 2021 16:34:52 +0100 Subject: [PATCH] [ticket/15392] Replace remaining dirname(__FILE__) with __DIR__ PHPBB3-15392 --- tests/auth/provider_ldap_test.php | 2 +- tests/cache/file_driver_test.php | 2 +- tests/cache/memcached_test.php | 4 ++-- tests/console/cache/purge_test.php | 2 +- tests/controller/common_helper_route.php | 2 +- tests/dbal/migrator_tool_module_test.php | 6 +++--- tests/di/container_cache_directory_test.php | 2 +- tests/functions_content/phpbb_format_quote_test.php | 2 +- tests/functions_user/whois_test.php | 2 +- tests/group/helper_get_name_string_test.php | 2 +- tests/group/helper_get_name_test.php | 2 +- tests/group/helper_get_rank_test.php | 2 +- tests/migrator/get_callable_from_step_test.php | 2 +- tests/notification/notification_method_email_test.php | 6 +++--- tests/notification/submit_post_type_forum_test.php | 2 +- tests/profilefields/manager_test.php | 2 +- tests/profilefields/type_url_test.php | 6 +++--- tests/template/extension_test.php | 2 +- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/auth/provider_ldap_test.php b/tests/auth/provider_ldap_test.php index 7234138a7d..463b48d438 100644 --- a/tests/auth/provider_ldap_test.php +++ b/tests/auth/provider_ldap_test.php @@ -45,7 +45,7 @@ class phpbb_auth_provider_ldap_test extends phpbb_database_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml'); + return $this->createXMLDataSet(__DIR__ . '/fixtures/user.xml'); } /** diff --git a/tests/cache/file_driver_test.php b/tests/cache/file_driver_test.php index eb9ee244f1..10c9aec182 100644 --- a/tests/cache/file_driver_test.php +++ b/tests/cache/file_driver_test.php @@ -26,7 +26,7 @@ class phpbb_cache_file_driver_test extends phpbb_cache_common_test_case { parent::setUp(); - $this->cache_dir = dirname(__FILE__) . '/../tmp/cache/'; + $this->cache_dir = __DIR__ . '/../tmp/cache/'; if (file_exists($this->cache_dir)) { diff --git a/tests/cache/memcached_test.php b/tests/cache/memcached_test.php index 14499e7423..172be10624 100644 --- a/tests/cache/memcached_test.php +++ b/tests/cache/memcached_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/common_test_case.php'; +require_once __DIR__ . '/common_test_case.php'; class phpbb_cache_memcached_driver_test extends \phpbb_cache_common_test_case { @@ -19,7 +19,7 @@ class phpbb_cache_memcached_driver_test extends \phpbb_cache_common_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + return $this->createXMLDataSet(__DIR__ . '/fixtures/config.xml'); } static public function setUpBeforeClass(): void diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index ab5cedc51a..06dcbd547f 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -29,7 +29,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; + $this->cache_dir = __DIR__ . '/tmp/cache/'; if (file_exists($this->cache_dir)) { diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 760679b71f..b565f17f1a 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -38,7 +38,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml'); + return $this->createXMLDataSet(__DIR__ . '/../fixtures/empty.xml'); } protected function setUp(): void diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index d1796ca97c..7d192dfecf 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -11,8 +11,8 @@ * */ -require_once dirname(__FILE__) . '/ext/foo/bar/acp/acp_test_info.php'; -require_once dirname(__FILE__) . '/ext/foo/bar/ucp/ucp_test_info.php'; +require_once __DIR__ . '/ext/foo/bar/acp/acp_test_info.php'; +require_once __DIR__ . '/ext/foo/bar/ucp/ucp_test_info.php'; class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { @@ -43,7 +43,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); // Correctly set the root path for this test to this directory, so the classes can be found - $phpbb_root_path = dirname(__FILE__) . '/'; + $phpbb_root_path = __DIR__ . '/'; $phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path); $module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx); diff --git a/tests/di/container_cache_directory_test.php b/tests/di/container_cache_directory_test.php index bbd3582dc1..75ca88584a 100644 --- a/tests/di/container_cache_directory_test.php +++ b/tests/di/container_cache_directory_test.php @@ -26,7 +26,7 @@ namespace public function setUp(): void { - $this->phpbb_root_path = dirname(__FILE__) . '/'; + $this->phpbb_root_path = __DIR__ . '/'; $this->config_php = new \phpbb\config_php_file($this->phpbb_root_path . 'fixtures/', 'php'); $this->filename = $this->phpbb_root_path . '../tmp/container.php'; diff --git a/tests/functions_content/phpbb_format_quote_test.php b/tests/functions_content/phpbb_format_quote_test.php index 2f19c198e7..04dc620c29 100644 --- a/tests/functions_content/phpbb_format_quote_test.php +++ b/tests/functions_content/phpbb_format_quote_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php'; +require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case { diff --git a/tests/functions_user/whois_test.php b/tests/functions_user/whois_test.php index 0ab5bc0ef6..4dd72311bb 100644 --- a/tests/functions_user/whois_test.php +++ b/tests/functions_user/whois_test.php @@ -7,7 +7,7 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; class phpbb_functions_user_whois_test extends phpbb_test_case { diff --git a/tests/group/helper_get_name_string_test.php b/tests/group/helper_get_name_string_test.php index c626328dcc..34dab1471d 100644 --- a/tests/group/helper_get_name_string_test.php +++ b/tests/group/helper_get_name_string_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/helper_test_case.php'; +require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_case { diff --git a/tests/group/helper_get_name_test.php b/tests/group/helper_get_name_test.php index b39b2cbedd..d7e906ce9c 100644 --- a/tests/group/helper_get_name_test.php +++ b/tests/group/helper_get_name_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/helper_test_case.php'; +require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_name_test extends phpbb_group_helper_test_case { diff --git a/tests/group/helper_get_rank_test.php b/tests/group/helper_get_rank_test.php index 5efd8ad95e..95dc2ae600 100644 --- a/tests/group/helper_get_rank_test.php +++ b/tests/group/helper_get_rank_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/helper_test_case.php'; +require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_rank_test extends phpbb_group_helper_test_case { diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php index 1dbcc264b5..9d8748bf5b 100644 --- a/tests/migrator/get_callable_from_step_test.php +++ b/tests/migrator/get_callable_from_step_test.php @@ -64,7 +64,7 @@ class get_callable_from_step_test extends phpbb_database_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/../dbal/fixtures/migrator.xml'); + return $this->createXMLDataSet(__DIR__ . '/../dbal/fixtures/migrator.xml'); } public function get_callable_from_step_provider() diff --git a/tests/notification/notification_method_email_test.php b/tests/notification/notification_method_email_test.php index 8c442d4e0b..63e2dfb343 100644 --- a/tests/notification/notification_method_email_test.php +++ b/tests/notification/notification_method_email_test.php @@ -15,7 +15,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -require_once dirname(__FILE__) . '/base.php'; +require_once __DIR__ . '/base.php'; class notification_method_email_test extends phpbb_tests_notification_base { @@ -24,7 +24,7 @@ class notification_method_email_test extends phpbb_tests_notification_base public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/email_notification.type.post.xml'); + return $this->createXMLDataSet(__DIR__ . '/fixtures/email_notification.type.post.xml'); } protected function get_notification_methods() @@ -257,7 +257,7 @@ class notification_method_email_test extends phpbb_tests_notification_base 'post_username' => '', 'forum_name' => '', ], - + $post_data); $notification_options = [ 'item_id' => $post_data['post_id'], diff --git a/tests/notification/submit_post_type_forum_test.php b/tests/notification/submit_post_type_forum_test.php index 1635f65863..7f06b18951 100644 --- a/tests/notification/submit_post_type_forum_test.php +++ b/tests/notification/submit_post_type_forum_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/submit_post_base.php'; +require_once __DIR__ . '/submit_post_base.php'; class phpbb_notification_submit_post_type_forum_test extends phpbb_notification_submit_post_base { diff --git a/tests/profilefields/manager_test.php b/tests/profilefields/manager_test.php index 5503061fa6..04b0508bc1 100644 --- a/tests/profilefields/manager_test.php +++ b/tests/profilefields/manager_test.php @@ -36,7 +36,7 @@ class manager_test extends phpbb_database_test_case */ public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/manager.xml'); + return $this->createXMLDataSet(__DIR__ . '/fixtures/manager.xml'); } protected function setUp(): void diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index db0aa43a9c..8c2b3ed707 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -11,9 +11,9 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_profilefield_type_url_test extends phpbb_test_case { diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php index 1d2221bb09..6308928325 100644 --- a/tests/template/extension_test.php +++ b/tests/template/extension_test.php @@ -11,7 +11,7 @@ * */ -require_once dirname(__FILE__) . '/template_test_case.php'; +require_once __DIR__ . '/template_test_case.php'; class phpbb_template_extension_test extends phpbb_template_template_test_case {