diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 46a99e607e..0ca3384469 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -35,7 +35,7 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('auth.provider_collection', array( - 'auth.provider.acp_board_valid' => new phpbb\auth\provider\acp\board_valid('', ''), + 'auth.provider.acp_board_valid' => new phpbb\auth\provider\acp\board_valid, 'auth.provider.acp_board_invalid' => new phpbb\auth\provider\acp\board_invalid, )); diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php index 176ff5a04b..e4eb5e56b9 100644 --- a/tests/attachment/delete_test.php +++ b/tests/attachment/delete_test.php @@ -97,7 +97,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case */ public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false) { - $this->storage = $this->createMock('\phpbb\storage\storage', array('delete', 'exists')); + $this->storage = $this->createMock('\phpbb\storage\storage'); if ($throw_exception) { $this->storage->expects($this->any()) diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 31be572272..ae2c96ba84 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -119,7 +119,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $this->mimetype_guesser )); - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec_storage', new \phpbb\files\filespec_storage( $this->language, new \FastImageSize\FastImageSize(), @@ -140,7 +140,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $this->request )); $this->factory = new \phpbb\files\factory($this->container); - $this->files_upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $phpbb_root_path); + $this->files_upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $this->phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $this->temp = new \phpbb\filesystem\temp($this->filesystem, ''); $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 651a7ab305..95525bd933 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -28,8 +28,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case protected function setUp(): void { - global $phpbb_root_path, $phpEx; - $this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; if (file_exists($this->cache_dir)) @@ -45,10 +43,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case $this->db = $this->createMock('\phpbb\db\driver\driver_interface'); $this->config = new \phpbb\config\config(array('assets_version' => 1)); - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime') - ); + $this->user = $this->createMock('\phpbb\user'); } public function test_purge() diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php index 912f252b60..b828be2ec4 100644 --- a/tests/console/config/config_test.php +++ b/tests/console/config/config_test.php @@ -26,10 +26,7 @@ class phpbb_console_command_config_test extends phpbb_test_case $this->config = new \phpbb\config\config(array()); - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime') - ); + $this->user = $this->createMock('\phpbb\user'); $this->user->method('lang')->will($this->returnArgument(0)); } diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index 69ae53c128..fb6fe3c502 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -34,10 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $this->user = $this->createMock('\phpbb\user'); $this->user->method('lang')->will($this->returnArgument(0)); } diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index dffbbbf55f..013e841442 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -40,10 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $this->user = $this->createMock('\phpbb\user'); $this->user->method('lang')->will($this->returnArgument(0)); $this->task = new phpbb_cron_task_simple(); diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index fb8e146e3c..cbe743bdef 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -50,14 +50,11 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case )); $this->db = $this->db = $this->new_dbal(); - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime') - ); + $this->user = $this->createMock('\phpbb\user'); $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; - $this->cache = $this->createMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); + $this->cache = $this->createMock('\phpbb\cache\service'); $this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array( 'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE), 'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE), diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index 6812ea61b8..555c9454e1 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -84,10 +84,7 @@ class phpbb_console_command_check_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); - $user = $this->createMock('\phpbb\user', array(), array( - $this->language, - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $user->method('lang')->will($this->returnArgument(0)); $cache = $this->getMockBuilder('\phpbb\cache\service') diff --git a/tests/console/user/base.php b/tests/console/user/base.php index e34efa85b1..c40a0070ac 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -62,10 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $this->language->expects($this->any()) ->method('lang') ->will($this->returnArgument(0)); - $user = $this->user = $this->createMock('\phpbb\user', array(), array( - $this->language, - '\phpbb\datetime' - )); + $user = $this->user = $this->createMock('\phpbb\user'); $this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index b34905bdfa..6b128269a3 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -125,7 +125,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $cache_path, null, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, @@ -151,7 +151,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); - $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); + $this->router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/'); $this->auth = new \phpbb\auth\auth(); $this->cache = new \phpbb\cache\driver\dummy(); $this->db = $this->new_dbal(); diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index f952e969c2..0f5bc34cd4 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -48,7 +48,7 @@ class phpbb_controller_controller_test extends phpbb_test_case new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); - $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); + $router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/'); $routes = $router->get_routes(); // This will need to be updated if any new routes are defined diff --git a/tests/email/email_parsing_test.php b/tests/email/email_parsing_test.php index 041e659934..be61d82bde 100644 --- a/tests/email/email_parsing_test.php +++ b/tests/email/email_parsing_test.php @@ -73,7 +73,7 @@ class phpbb_email_parsing_test extends phpbb_test_case $cache_path, null, new \phpbb\template\twig\loader(''), - new \phpbb\event\dispatcher($phpbb_container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php index da28d24daa..deebfc657c 100644 --- a/tests/event/dispatcher_test.php +++ b/tests/event/dispatcher_test.php @@ -15,7 +15,7 @@ class phpbb_event_dispatcher_test extends phpbb_test_case { public function test_trigger_event() { - $dispatcher = new \phpbb\event\dispatcher(new phpbb_mock_container_builder()); + $dispatcher = new \phpbb\event\dispatcher(); $dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) { $event['foo'] = $event['foo'] . '2'; diff --git a/tests/event/export_php_test.php b/tests/event/export_php_test.php index 0dd60b2a92..4412b6d0bd 100644 --- a/tests/event/export_php_test.php +++ b/tests/event/export_php_test.php @@ -28,7 +28,7 @@ class phpbb_event_export_php_test extends phpbb_test_case { global $phpbb_root_path; $exporter = new \phpbb\event\php_exporter($phpbb_root_path); - $files = $exporter->get_recursive_file_list($phpbb_root_path); + $files = $exporter->get_recursive_file_list(); $data_provider = array(); foreach ($files as $file) diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php index 2eeb48ea05..c4ea3fbecc 100644 --- a/tests/event/md_exporter_test.php +++ b/tests/event/md_exporter_test.php @@ -126,7 +126,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case ); foreach ($styles as $path => $filter) { - $files = $exporter->get_recursive_file_list($phpbb_root_path . $path, $path); + $files = $exporter->get_recursive_file_list($phpbb_root_path . $path); foreach ($files as $file) { $data_provider[] = array($filter, $path . $file); diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 2e1a85a013..b37f6742a2 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -69,7 +69,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $cache_path, null, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php index 680ae75c92..877c4c98e2 100644 --- a/tests/files/types_base_test.php +++ b/tests/files/types_base_test.php @@ -41,7 +41,7 @@ class phpbb_files_types_base_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php index 578a63c7ab..dd9ad7280c 100644 --- a/tests/files/types_form_test.php +++ b/tests/files/types_form_test.php @@ -50,7 +50,7 @@ class phpbb_files_types_form_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, @@ -158,7 +158,7 @@ class phpbb_files_types_form_test extends phpbb_test_case ->willReturn($plupload); $type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request); - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')); $type_form->set_upload($upload); diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php index f663e7277e..106f8cda2f 100644 --- a/tests/files/types_local_test.php +++ b/tests/files/types_local_test.php @@ -50,7 +50,7 @@ class phpbb_files_types_local_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, @@ -147,7 +147,7 @@ class phpbb_files_types_local_test extends phpbb_test_case $this->factory = new \phpbb\files\factory($this->container); $type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request); - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')); $type_local->set_upload($upload); diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php index f683c1553a..e404c928b9 100644 --- a/tests/files/types_remote_test.php +++ b/tests/files/types_remote_test.php @@ -57,7 +57,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, @@ -75,7 +75,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case public function test_upload_fsock_fail() { $type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request); - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')); $type_remote->set_upload($upload); @@ -110,7 +110,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case ->method('getString') ->willReturn($max_file_size); $type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $php_ini, $this->request); - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')); $type_remote->set_upload($upload); @@ -122,7 +122,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case public function test_upload_wrong_path() { $type_remote = new \phpbb\files\types\foo($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request); - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')); $type_remote->set_upload($upload); $type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path'; diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index e601144445..1fda63e453 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -31,9 +31,6 @@ class phpbb_files_upload_test extends phpbb_test_case /** @var \phpbb\request\request_interface */ protected $request; - /** @var string phpBB root path */ - protected $phpbb_root_path; - protected function setUp(): void { // Global $config required by unique_id @@ -53,7 +50,7 @@ class phpbb_files_upload_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, @@ -64,13 +61,11 @@ class phpbb_files_upload_test extends phpbb_test_case 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), )))); $this->factory = new \phpbb\files\factory($this->container); - - $this->phpbb_root_path = $phpbb_root_path; } public function test_reset_vars() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_max_filesize(500); $this->assertEquals(500, $upload->max_filesize); $upload->reset_vars(); @@ -79,7 +74,7 @@ class phpbb_files_upload_test extends phpbb_test_case public function test_set_disallowed_content() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $disallowed_content = new ReflectionProperty($upload, 'disallowed_content'); $disallowed_content->setAccessible(true); @@ -97,7 +92,7 @@ class phpbb_files_upload_test extends phpbb_test_case public function test_is_valid() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $this->assertFalse($upload->is_valid('foobar')); } @@ -120,7 +115,7 @@ class phpbb_files_upload_test extends phpbb_test_case */ public function test_assign_internal_error($error_code, $expected) { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $this->assertSame($expected, $upload->assign_internal_error($error_code)); } } diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index dbe44a4a9d..9cb6434922 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -79,7 +79,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_invalid_extension() { /** @var \phpbb\files\upload $upload */ - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_error_prefix('') ->set_allowed_extensions(array('jpg')) ->set_max_filesize(100); @@ -90,7 +90,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_empty_file() { /** @var \phpbb\files\upload $upload */ - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_error_prefix('') ->set_allowed_extensions(array('jpg')) ->set_max_filesize(100); @@ -101,7 +101,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_successful_upload() { /** @var \phpbb\files\upload $upload */ - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_error_prefix('') ->set_allowed_extensions(array('gif')) ->set_max_filesize(2000); @@ -114,7 +114,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_too_large() { /** @var \phpbb\files\upload $upload */ - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_error_prefix('') ->set_allowed_extensions(array('gif')) ->set_max_filesize(100); diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index a97300b9ee..2c8be363e7 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -152,7 +152,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $cookies = self::$cookieJar->all(); // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie - foreach ($cookies as $cookie); + foreach ($cookies as $cookie) { if (substr($cookie->getName(), -4) == '_sid') { diff --git a/tests/functional/visibility_unapproved_posts_test.php b/tests/functional/visibility_unapproved_posts_test.php index 9f6491d1d8..8d56af2c4e 100644 --- a/tests/functional/visibility_unapproved_posts_test.php +++ b/tests/functional/visibility_unapproved_posts_test.php @@ -162,7 +162,7 @@ class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_ $this->create_user('unapproved_posts_test_user#2'); $this->login('unapproved_posts_test_user#2'); - $this->add_lang('posting', 'viewtopic', 'mcp'); + $this->add_lang(['posting', 'viewtopic', 'mcp']); // should be able to see topic 1 but not unapproved post $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Unapproved Posts Test Topic #1']}&sid={$this->sid}"); diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php index e5377ae5f0..d28ce27629 100644 --- a/tests/installer/module_base_test.php +++ b/tests/installer/module_base_test.php @@ -43,7 +43,7 @@ class module_base_test extends phpbb_test_case $this->module = new test_installer_module($module_collection, true, false); $iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface'); - $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php'); + $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), ''); $this->module->setup($config, $iohandler); } diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php index c3f1a0beba..ca1acbfbb3 100644 --- a/tests/log/function_add_log_test.php +++ b/tests/log/function_add_log_test.php @@ -159,10 +159,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index af58014d98..f55870347f 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -95,10 +95,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $storage = $this->createMock('\phpbb\storage\storage'); // User - $user = $this->createMock('\phpbb\user', array(), array( - $lang, - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $user->ip = ''; $user->data = array( 'user_id' => 2, diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 3364873219..77f621b8db 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -29,10 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $this->user = $this->createMock('\phpbb\user'); $this->user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); @@ -45,7 +42,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager); - $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); + $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, 'php', dirname(__FILE__) . '/'); $request = new phpbb_mock_request(); $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER); diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 74b257ac38..dd2f61991e 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -301,13 +301,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case { if ($use_new_interface) { - $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface'); $test_driver->method('needs_rehash') ->willReturn($needs_rehash); } else { - $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface'); } $config = new \phpbb\config\config(array()); diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 561c4f5ec3..49e431eed1 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -165,9 +165,7 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) { - $symfony_request = $this->createMock('\phpbb\symfony_request', array(), array( - new phpbb_mock_request(), - )); + $symfony_request = $this->createMock('\phpbb\symfony_request'); $symfony_request->expects($this->any()) ->method('getPathInfo') ->will($this->returnValue($getPathInfo)); @@ -185,7 +183,7 @@ class phpbb_path_helper_test extends phpbb_test_case 'php' ); - $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request)); + $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input)); } public function clean_url_data() diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index 2eaa1389cf..7b2d4112dc 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -24,12 +24,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case */ protected function setUp(): void { - global $phpbb_root_path, $phpEx; - - $this->user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $this->user = $this->createMock('\phpbb\user'); $this->user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index b19e2f0993..733f397911 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -23,12 +23,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case */ protected function setUp(): void { - global $phpbb_root_path, $phpEx; - - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index 0a64cfdafd..a8d0399fd4 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -19,16 +19,13 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case /** * Sets up basic test objects * - * @access protected + * @access protected */ protected function setUp(): void { - global $config, $request, $user, $cache, $phpbb_root_path, $phpEx; + global $config, $request, $user, $cache; - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $cache = new phpbb_mock_cache; $user->expects($this->any()) ->method('lang') diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index 14b268a91d..d203234f2a 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -27,14 +27,11 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case */ protected function setUp(): void { - global $config, $request, $user, $cache, $phpbb_root_path, $phpEx; + global $config, $request, $user, $cache; $config = new \phpbb\config\config([]); $cache = new phpbb_mock_cache; - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php index 3d2fdd8959..8467732bda 100644 --- a/tests/template/asset_test.php +++ b/tests/template/asset_test.php @@ -41,7 +41,7 @@ class phpbb_template_asset_test extends phpbb_test_case $path_helper->method('get_phpbb_root_path') ->willReturn($phpbb_root_path); - $asset = new asset('', $path_helper, new phpbb\filesystem\filesystem()); + $asset = new asset('', $path_helper); $asset->set_path($path, true); $this->assertEquals($expected, $asset->get_path()); diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php index 5d73aed91e..2320aa2331 100644 --- a/tests/template/extension_test.php +++ b/tests/template/extension_test.php @@ -90,7 +90,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case $cache_path, null, $loader, - new \phpbb\event\dispatcher($phpbb_container), + new \phpbb\event\dispatcher(), [ 'cache' => false, 'debug' => false, diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index de4d663fb8..c322923fb1 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -55,7 +55,6 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case ) ); - $container = new phpbb_mock_container_builder(); $cache_path = $phpbb_root_path . 'cache/twig'; $context = new \phpbb\template\context(); $loader = new \phpbb\template\twig\loader(''); @@ -66,7 +65,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case $cache_path, $this->extension_manager, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 7693e84db9..786f1af583 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -149,7 +149,6 @@ Zeta test event in all', $phpEx ); - $container = new phpbb_mock_container_builder(); $cache_path = $phpbb_root_path . 'cache/twig'; $context = new \phpbb\template\context(); $loader = new \phpbb\template\twig\loader(''); @@ -160,7 +159,7 @@ Zeta test event in all', $cache_path, $this->extension_manager, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index 9f90a00b1a..7206bc1d43 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -41,7 +41,6 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $container = new phpbb_mock_container_builder(); $cache_path = $phpbb_root_path . 'cache/twig'; $context = new \phpbb\template\context(); $loader = new \phpbb\template\twig\loader(''); @@ -52,7 +51,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te $cache_path, null, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 3a64d70f30..18b067bb30 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -93,7 +93,6 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template_path = $this->test_path . '/templates'; - $container = new phpbb_mock_container_builder(); $cache_path = $phpbb_root_path . 'cache/twig'; $context = new \phpbb\template\context(); $loader = new \phpbb\template\twig\loader(''); @@ -104,7 +103,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $cache_path, null, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index d21baa3fd4..3db07196c4 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -36,7 +36,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $container = new phpbb_mock_container_builder(); $cache_path = $phpbb_root_path . 'cache/twig'; $context = new \phpbb\template\context(); $loader = new \phpbb\template\twig\loader(''); @@ -47,7 +46,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $cache_path, null, $loader, - new \phpbb\event\dispatcher($container), + new \phpbb\event\dispatcher(), array( 'cache' => false, 'debug' => false, diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 5ef545781c..b73baaeb94 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -359,7 +359,7 @@ abstract class phpbb_database_test_case extends TestCase static $core_tables = []; - if (empty($tables)) + if (empty($core_tables)) { $tables_yml_data = \Symfony\Component\Yaml\Yaml::parseFile($phpbb_root_path . '/config/default/container/tables.yml'); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 638217f98d..d107ce47d1 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -720,10 +720,7 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); @@ -757,10 +754,7 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->createMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $user = $this->createMock('\phpbb\user'); $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); @@ -806,7 +800,7 @@ class phpbb_functional_test_case extends phpbb_test_case $cookies = self::$cookieJar->all(); // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie - foreach ($cookies as $cookie); + foreach ($cookies as $cookie) { if (substr($cookie->getName(), -4) == '_sid') { @@ -855,7 +849,7 @@ class phpbb_functional_test_case extends phpbb_test_case $cookies = self::$cookieJar->all(); // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie - foreach ($cookies as $cookie); + foreach ($cookies as $cookie) { if (substr($cookie->getName(), -4) == '_sid') { diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 1cbe895a72..a5b897d180 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -68,7 +68,7 @@ class phpbb_fileupload_test extends phpbb_test_case $guessers[3]->set_priority(-2); $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers); - $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container = new phpbb_mock_container_builder(); $this->container->set('files.filespec', new \phpbb\files\filespec( $this->filesystem, $this->language, @@ -120,7 +120,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_invalid_extension() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('png')) ->set_max_filesize(100); $file = $this->gen_valid_filespec(); @@ -130,7 +130,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_disallowed_content() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(1000); $file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path); @@ -149,7 +149,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_invalid_filename() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(100); $file = $this->gen_valid_filespec(); @@ -160,7 +160,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_too_large() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(100); $file = $this->gen_valid_filespec(); @@ -171,7 +171,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_valid_file() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(1000); $file = $this->gen_valid_filespec(); @@ -181,7 +181,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_local_upload() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(1000); @@ -195,7 +195,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_move_existent_file() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(1000); @@ -209,7 +209,7 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_move_existent_file_overwrite() { - $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request); $upload->set_allowed_extensions(array('jpg')) ->set_max_filesize(1000); diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php index a6fd85f428..83b343f602 100644 --- a/tests/viewonline/helper_test.php +++ b/tests/viewonline/helper_test.php @@ -19,7 +19,7 @@ class phpbb_viewonline_helper_test extends phpbb_test_case { parent::setUp(); - $this->viewonline_helper = new \phpbb\viewonline_helper(new \phpbb\filesystem\filesystem()); + $this->viewonline_helper = new \phpbb\viewonline_helper(); } public function session_pages_data()