From 8a990240876316d72e7685381a9c0a106c925adc Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 16 Jul 2025 17:36:45 +0700 Subject: [PATCH] [ticket/17535] Convert config files, make data providers static PHPBB-17535 --- .github/phpunit-mariadb-github.xml | 71 +++--- .github/phpunit-mssql-github.xml | 75 +++--- .github/phpunit-mysql-github.xml | 75 +++--- .github/phpunit-postgres-github.xml | 75 +++--- .github/phpunit-psql-windows-github.xml | 75 +++--- .github/phpunit-sqlite3-github.xml | 63 +++-- .github/workflows/tests.yml | 8 +- phpunit.xml.dist | 31 ++- tests/attachment/delete_test.php | 4 +- tests/attachment/manager_test.php | 2 +- tests/attachment/resync_test.php | 2 +- tests/attachment/upload_test.php | 4 +- tests/avatar/driver_gravatar_test.php | 2 +- tests/avatar/manager_test.php | 8 +- tests/ban/ban_manager_test.php | 12 +- tests/bbcode/parser_test.php | 12 +- tests/bbcode/url_bbcode_test.php | 12 +- tests/cache/redis_driver_test.php | 6 +- tests/captcha/qa_test.php | 2 +- tests/compress/compress_test.php | 2 +- tests/console/user/activate_test.php | 2 +- tests/content_visibility/delete_post_test.php | 2 +- .../get_forums_visibility_sql_test.php | 2 +- .../get_global_visibility_sql_test.php | 2 +- .../get_visibility_sql_test.php | 2 +- .../set_post_visibility_test.php | 4 +- .../set_topic_visibility_test.php | 2 +- tests/controller/common_helper_route.php | 224 +++++++++--------- tests/controller/controller_test.php | 2 +- tests/controller/helper_route_other_app.php | 2 +- tests/controller/helper_route_slash_test.php | 2 +- tests/datetime/from_format_test.php | 4 +- tests/dbal/migrator_tool_module_test.php | 4 +- .../migrator_tool_permission_role_test.php | 4 +- tests/dbal/migrator_tool_permission_test.php | 6 +- tests/dbal/select_test.php | 18 +- tests/dbal/write_test.php | 4 +- tests/email/email_parsing_test.php | 2 +- tests/event/exception_listener_test.php | 2 +- tests/extension/extension_base_test.php | 2 +- tests/extension/finder_test.php | 2 +- tests/extension/metadata_manager_test.php | 6 +- tests/extension/modules_test.php | 2 +- tests/feed/attachments_base_test.php | 2 +- tests/files/types_base_test.php | 2 +- tests/files/types_form_test.php | 2 +- tests/files/types_local_test.php | 2 +- tests/files/upload_test.php | 2 +- tests/filesystem/clean_path_test.php | 2 +- tests/filesystem/helper_clean_path_test.php | 2 +- tests/filesystem/helper_is_absolute_test.php | 2 +- tests/filesystem/helper_realpath_test.php | 4 +- tests/filesystem/is_absolute_test.php | 2 +- tests/filesystem/realpath_test.php | 4 +- tests/functional/acp_bbcodes_test.php | 2 +- tests/functional/acp_groups_test.php | 2 +- tests/functional/acp_permissions_test.php | 2 +- tests/functional/acp_profile_field_test.php | 2 +- tests/functional/avatar_acp_groups_test.php | 2 +- tests/functional/avatar_acp_users_test.php | 2 +- tests/functional/avatar_ucp_groups_test.php | 2 +- tests/functional/avatar_ucp_users_test.php | 2 +- tests/functional/common_groups_test_case.php | 2 +- tests/functional/extension_acp_test.php | 1 + tests/functional/forum_password_test.php | 2 +- tests/functional/mcp/mcp_main_test.php | 4 +- tests/functional/permission_roles_test.php | 2 +- tests/functional/plupload_test.php | 2 +- tests/functional/posting_test.php | 2 +- tests/functional/user_password_reset_test.php | 2 +- tests/functions/build_url_test.php | 10 +- .../functions/convert_30_dbms_to_31_test.php | 2 +- tests/functions/generate_string_list.php | 2 +- .../functions/get_formatted_filesize_test.php | 2 +- tests/functions/get_preg_expression_test.php | 2 +- tests/functions/make_clickable_email_test.php | 12 +- tests/functions/make_clickable_test.php | 17 +- tests/functions/obtain_online_test.php | 6 +- tests/functions/parse_cfg_file_test.php | 2 +- tests/functions/phpbb_get_banned_user_ids.php | 2 +- .../phpbb_get_install_redirect_test.php | 2 +- tests/functions/quoteattr_test.php | 2 +- tests/functions/short_ipv6__test.php | 2 +- tests/functions/style_select_test.php | 2 +- tests/functions/validate_hex_colour_test.php | 18 +- tests/functions/validate_password_test.php | 2 +- tests/functions/validate_user_email_test.php | 10 +- tests/functions/validate_username_test.php | 2 +- .../functions_acp/build_cfg_template_test.php | 14 +- tests/functions_acp/build_select_test.php | 2 +- .../insert_config_array_test.php | 2 +- .../validate_config_vars_test.php | 4 +- tests/functions_acp/validate_range_test.php | 8 +- tests/functions_content/get_context_test.php | 4 +- .../get_username_string_test.php | 10 +- .../phpbb_clean_search_string_test.php | 2 +- .../phpbb_format_quote_test.php | 2 +- tests/functions_user/delete_user_test.php | 8 +- .../group_user_attributes_test.php | 2 +- tests/functions_user/whois_test.php | 2 +- tests/group/helper_get_name_string_test.php | 10 +- tests/group/helper_get_rank_test.php | 2 +- tests/groupposition/legend_test.php | 12 +- tests/groupposition/teampage_test.php | 14 +- tests/help/manager_test.php | 4 +- tests/installer/database_helper_test.php | 6 +- tests/json/sanitizer_test.php | 2 +- tests/log/delete_test.php | 2 +- tests/mcp/post_ip_test.php | 4 +- tests/mention/controller_test.php | 2 +- tests/messenger/method_email_test.php | 2 +- .../migrations_check_config_added_test.php | 20 +- .../migrator/get_callable_from_step_test.php | 2 +- tests/migrator/get_schema_steps_test.php | 2 +- tests/migrator/reverse_update_data_test.php | 4 +- tests/migrator/schema_generator_test.php | 2 +- tests/mimetype/guesser_test.php | 10 +- tests/mock/user.php | 1 + tests/network/ip_normalise_test.php | 2 +- .../notification_method_email_test.php | 2 +- .../notification_method_webpush_test.php | 4 +- tests/notification/submit_post_base.php | 31 ++- .../submit_post_type_bookmark_test.php | 4 +- .../submit_post_type_forum_test.php | 4 +- .../submit_post_type_mention_test.php | 19 +- .../submit_post_type_post_in_queue_test.php | 4 +- .../submit_post_type_post_test.php | 4 +- .../submit_post_type_quote_test.php | 15 +- .../submit_post_type_topic_test.php | 10 +- tests/notification/user_list_trim_test.php | 2 +- tests/pagination/pagination_test.php | 10 +- tests/passwords/drivers_test.php | 81 +++---- tests/passwords/manager_test.php | 14 +- tests/path_helper/path_helper_test.php | 91 ++++--- tests/plupload/plupload_test.php | 4 +- tests/profilefields/type_bool_test.php | 6 +- tests/profilefields/type_date_test.php | 6 +- tests/profilefields/type_dropdown_test.php | 6 +- tests/profilefields/type_int_test.php | 6 +- tests/profilefields/type_string_test.php | 6 +- tests/profilefields/type_url_test.php | 6 +- tests/regex/censor_test.php | 2 +- tests/regex/email_test.php | 4 +- tests/regex/ipv4_test.php | 4 +- tests/regex/ipv6_test.php | 4 +- tests/regex/password_complexity_test.php | 4 +- tests/regex/table_prefix_test.php | 2 +- tests/regex/url_test.php | 2 +- tests/request/request_test.php | 2 +- tests/request/request_var_test.php | 4 +- tests/request/type_cast_helper_test.php | 2 +- tests/search/common_test_case.php | 2 +- tests/search/mysql_test.php | 6 +- tests/search/native_test.php | 12 +- tests/search/postgres_test.php | 6 +- tests/security/extract_current_page_test.php | 2 +- tests/security/redirect_test.php | 2 +- tests/session/append_sid_test.php | 2 +- tests/template/asset_test.php | 2 +- tests/template/context_test.php | 2 +- tests/template/extension_test.php | 4 +- tests/template/template_events_test.php | 2 +- tests/template/template_includecss_test.php | 2 +- tests/template/template_includejs_test.php | 4 +- tests/template/template_inheritance_test.php | 2 +- tests/template/template_test.php | 6 +- tests/template/twig_test.php | 2 +- tests/text_formatter/s9e/acp_utils_test.php | 2 +- .../text_formatter/s9e/bbcode_merger_test.php | 2 +- .../s9e/default_formatting_test.php | 2 +- .../s9e/mention_helper_test.php | 4 +- tests/text_formatter/s9e/parser_test.php | 2 +- tests/text_formatter/s9e/renderer_test.php | 6 +- tests/text_formatter/s9e/utils_test.php | 10 +- tests/text_processing/censor_text_test.php | 2 +- tests/text_processing/decode_message_test.php | 4 +- .../generate_text_for_display_test.php | 4 +- .../generate_text_for_edit_test.php | 4 +- .../generate_text_for_storage_test.php | 2 +- tests/text_processing/make_clickable_test.php | 4 +- tests/text_processing/message_parser_test.php | 4 +- tests/text_processing/smilies_test.php | 2 +- tests/text_processing/strip_bbcode_test.php | 2 +- tests/text_processing/tickets_test.php | 2 +- .../text_reparser/plugins/post_text_test.php | 2 +- .../plugins/test_row_based_plugin.php | 2 +- .../tree/nestedset_forum_add_remove_test.php | 6 +- tests/tree/nestedset_forum_get_data_test.php | 10 +- tests/tree/nestedset_forum_move_test.php | 18 +- .../tree/nestedset_forum_regenerate_test.php | 2 +- tests/tree/nestedset_forum_test.php | 4 +- tests/ucp/controller_webpush_test.php | 2 +- tests/upload/filespec_test.php | 20 +- tests/upload/imagesize_test.php | 2 +- tests/utf/utf8_clean_string_test.php | 2 +- tests/version/version_helper_remote_test.php | 2 +- tests/version/version_helper_test.php | 10 +- tests/viewonline/helper_test.php | 2 +- tests/wrapper/version_compare_test.php | 4 +- 199 files changed, 879 insertions(+), 852 deletions(-) diff --git a/.github/phpunit-mariadb-github.xml b/.github/phpunit-mariadb-github.xml index 74b3b85483..e301ced053 100644 --- a/.github/phpunit-mariadb-github.xml +++ b/.github/phpunit-mariadb-github.xml @@ -1,39 +1,36 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + diff --git a/.github/phpunit-mssql-github.xml b/.github/phpunit-mssql-github.xml index 37c1deae2d..b3061cce0e 100644 --- a/.github/phpunit-mssql-github.xml +++ b/.github/phpunit-mssql-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-mysql-github.xml b/.github/phpunit-mysql-github.xml index d14359d618..e15519e8b2 100644 --- a/.github/phpunit-mysql-github.xml +++ b/.github/phpunit-mysql-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-postgres-github.xml b/.github/phpunit-postgres-github.xml index 2648f27bef..57333dacc5 100644 --- a/.github/phpunit-postgres-github.xml +++ b/.github/phpunit-postgres-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-psql-windows-github.xml b/.github/phpunit-psql-windows-github.xml index 5f131bae80..ab0c060010 100644 --- a/.github/phpunit-psql-windows-github.xml +++ b/.github/phpunit-psql-windows-github.xml @@ -1,41 +1,38 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-sqlite3-github.xml b/.github/phpunit-sqlite3-github.xml index b079a0bbbe..5c7e931b48 100644 --- a/.github/phpunit-sqlite3-github.xml +++ b/.github/phpunit-sqlite3-github.xml @@ -1,35 +1,32 @@ - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + slow + + + + + + + + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6c15bb25aa..72bd7d6d42 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -249,7 +249,7 @@ jobs: DB: ${{steps.database-type.outputs.db}} if: ${{ matrix.SLOWTESTS != 1 && matrix.NOTESTS != 1 }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --stop-on-error + phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --display-all-issues --stop-on-error - name: Slow tests env: @@ -378,7 +378,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --stop-on-error + phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --display-all-issues --stop-on-error # Other database types, namely sqlite3 and mssql other-tests: @@ -606,8 +606,8 @@ jobs: - name: Run unit tests if: ${{ matrix.type == 'unit' }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --stop-on-error --exclude-group functional,slow + phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow - name: Run functional tests if: ${{ matrix.type == 'functional' }} run: | - phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --stop-on-error --group functional + phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --group functional diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 722d67774a..58d0d5c1df 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,13 @@ - - - ./phpBB/includes/ - ./phpBB/phpbb/ - - + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + backupGlobals="true" + colors="true" + processIsolation="false" + stopOnFailure="false" + bootstrap="tests/bootstrap.php" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false"> ./tests @@ -35,4 +26,10 @@ slow + + + ./phpBB/includes/ + ./phpBB/phpbb/ + + diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php index e92319c078..73b7d75539 100644 --- a/tests/attachment/delete_test.php +++ b/tests/attachment/delete_test.php @@ -53,7 +53,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->resync, $this->storage); } - public function data_attachment_delete() + public static function data_attachment_delete() { return array( array('attach', '', false, false), @@ -83,7 +83,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->assertSame($expected, $this->attachment_delete->delete($mode, $ids, $resync)); } - public function data_attachment_unlink() + public static function data_attachment_unlink() { return array( array(true, true), diff --git a/tests/attachment/manager_test.php b/tests/attachment/manager_test.php index 4270c75695..88e39ed671 100644 --- a/tests/attachment/manager_test.php +++ b/tests/attachment/manager_test.php @@ -38,7 +38,7 @@ class phpbb_attachment_manager_test extends \phpbb_test_case return new \phpbb\attachment\manager($this->delete, $this->resync, $this->upload); } - public function data_manager() + public static function data_manager() { return array( array( diff --git a/tests/attachment/resync_test.php b/tests/attachment/resync_test.php index 9cadbea047..2168d68cf4 100644 --- a/tests/attachment/resync_test.php +++ b/tests/attachment/resync_test.php @@ -32,7 +32,7 @@ class phpbb_attachment_resync_test extends \phpbb_database_test_case $this->resync = new \phpbb\attachment\resync($this->db); } - public function data_resync() + public static function data_resync() { return array( array('', array(1), 'post_id', POSTS_TABLE, array('post_attachment' => '1'), array('post_attachment' => '1')), diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 5b7aa6bacf..76237021ec 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -165,7 +165,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case ); } - public function data_upload() + public static function data_upload() { return array( array('foobar', 1, false, @@ -280,7 +280,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case ), $filedata); } - public function data_image_upload() + public static function data_image_upload() { return array( array(false, false, array(), diff --git a/tests/avatar/driver_gravatar_test.php b/tests/avatar/driver_gravatar_test.php index 27ab847ff7..026655e11a 100644 --- a/tests/avatar/driver_gravatar_test.php +++ b/tests/avatar/driver_gravatar_test.php @@ -89,7 +89,7 @@ class phpbb_avatar_driver_gravatar_test extends \phpbb_database_test_case $this->template_data = array_merge($this->template_data, $data); } - public function data_prepare_form(): array + public static function data_prepare_form(): array { return [ [ diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 7c5453f13f..347f1597a4 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -148,7 +148,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']); } - public function get_driver_data_enabled() + public static function get_driver_data_enabled() { return array( array('avatar.driver.foobar', 'avatar.driver.foobar'), @@ -169,7 +169,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals($expected, ($driver === null) ? null : $driver->get_name()); } - public function get_driver_data_all() + public static function get_driver_data_all() { return array( array('avatar.driver.foobar', 'avatar.driver.foobar'), @@ -205,7 +205,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals($expected_settings, $avatar_settings); } - public function database_row_data() + public static function database_row_data() { return array( array( @@ -327,7 +327,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case ))); } - public function data_handle_avatar_delete() + public static function data_handle_avatar_delete() { return array( array( diff --git a/tests/ban/ban_manager_test.php b/tests/ban/ban_manager_test.php index 2eb49686d6..cdc64435b5 100644 --- a/tests/ban/ban_manager_test.php +++ b/tests/ban/ban_manager_test.php @@ -55,7 +55,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->phpbb_container = $phpbb_container; } - public function data_check_ban(): array + public static function data_check_ban(): array { return [ [ @@ -170,7 +170,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertEquals($expected, $this->ban_manager->check($user_data)); } - public function data_get_bans(): array + public static function data_get_bans(): array { return [ [ @@ -298,7 +298,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertEquals($expected, $actual); } - public function data_get_ban_end(): array + public static function data_get_ban_end(): array { return [ [ @@ -457,7 +457,7 @@ class ban_manager_test extends \phpbb_session_test_case )); } - public function data_test_ban(): array + public static function data_test_ban(): array { return [ [ @@ -629,7 +629,7 @@ class ban_manager_test extends \phpbb_session_test_case ); } - public function data_test_unban(): array + public static function data_test_unban(): array { return [ [ @@ -700,7 +700,7 @@ class ban_manager_test extends \phpbb_session_test_case $this->assertFalse($check->invoke($ban_type_ip, [], [])); } - public function data_get_ban_message(): array + public static function data_get_ban_message(): array { return [ [ diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php index f5f11ae900..0b91742bd8 100644 --- a/tests/bbcode/parser_test.php +++ b/tests/bbcode/parser_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; class phpbb_bbcode_parser_test extends \phpbb_test_case { - public function bbcode_firstpass_data() + public static function bbcode_firstpass_data() { return array( // Default bbcodes from in their simplest way @@ -249,10 +249,18 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case $this->markTestIncomplete($incomplete); } - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $phpbb_dispatcher, $config, $phpEx, $request, $symfony_request; + $phpEx = 'php'; + $config = new \phpbb\config\config([ + 'max_post_font_size' => 0, + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user; + $user->lang['UNAUTHORISED_BBCODE'] = 'UNAUTHORISED_BBCODE'; $request = new phpbb_mock_request; $symfony_request = new \phpbb\symfony_request($request); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $bbcode = new bbcode_firstpass(); $bbcode->mode = 'post'; diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php index 2dfed41b95..727648fb06 100644 --- a/tests/bbcode/url_bbcode_test.php +++ b/tests/bbcode/url_bbcode_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; class phpbb_url_bbcode_test extends phpbb_test_case { - public function url_bbcode_test_data() + public static function url_bbcode_test_data() { return array( array( @@ -52,10 +52,18 @@ class phpbb_url_bbcode_test extends phpbb_test_case */ public function test_url($description, $message, $expected) { - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $phpbb_dispatcher, $config, $phpEx, $request, $symfony_request; + $phpEx = 'php'; + $config = new \phpbb\config\config([ + 'max_post_font_size' => 0, + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user; + $user->lang['UNAUTHORISED_BBCODE'] = 'UNAUTHORISED_BBCODE'; $request = new phpbb_mock_request; $symfony_request = new \phpbb\symfony_request($request); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $bbcode = new bbcode_firstpass(); $bbcode->message = $message; diff --git a/tests/cache/redis_driver_test.php b/tests/cache/redis_driver_test.php index ec9de385a1..49f748526b 100644 --- a/tests/cache/redis_driver_test.php +++ b/tests/cache/redis_driver_test.php @@ -32,7 +32,7 @@ class phpbb_cache_redis_driver_test extends \phpbb_cache_common_test_case $config = phpbb_test_case_helpers::get_test_config(); if (isset($config['redis_host']) || isset($config['redis_port'])) { - $host = isset($config['redis_host']) ? $config['redis_host'] : 'localhost'; + $host = isset($config['redis_host']) ? $config['redis_host'] : '0.0.0.0'; $port = isset($config['redis_port']) ? $config['redis_port'] : 6379; self::$config = array('host' => $host, 'port' => $port); } @@ -46,12 +46,14 @@ class phpbb_cache_redis_driver_test extends \phpbb_cache_common_test_case protected function setUp(): void { - global $phpbb_root_path, $phpbb_container; + global $phpbb_root_path, $phpbb_container, $dbname, $table_prefix; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/'); + $config = phpbb_test_case_helpers::get_test_config(); + $dbname = $config['dbname']; $this->driver = new \phpbb\cache\driver\redis(self::$config['host'], self::$config['port']); $this->driver->purge(); } diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php index 1c61a7d10c..b91db97d6e 100644 --- a/tests/captcha/qa_test.php +++ b/tests/captcha/qa_test.php @@ -51,7 +51,7 @@ class phpbb_captcha_qa_test extends \phpbb_database_test_case $this->assertSame('foobar', $this->qa->get_service_name()); } - public function data_acp_get_question_input() + public static function data_acp_get_question_input() { return array( array("foobar\ntest\nyes", array( diff --git a/tests/compress/compress_test.php b/tests/compress/compress_test.php index 4d1f1fb018..7e77dc0349 100644 --- a/tests/compress/compress_test.php +++ b/tests/compress/compress_test.php @@ -120,7 +120,7 @@ class phpbb_compress_test extends phpbb_test_case } } - public function tar_archive_list() + public static function tar_archive_list() { return array( array('archive.tar', '.tar', array()), diff --git a/tests/console/user/activate_test.php b/tests/console/user/activate_test.php index 2ff65c3e3b..0f5830ee6b 100644 --- a/tests/console/user/activate_test.php +++ b/tests/console/user/activate_test.php @@ -50,7 +50,7 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base return new CommandTester($command); } - public function activate_test_data() + public static function activate_test_data() { return array( // Test an inactive user diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index b880c8f08f..2d9f32fa3f 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/delete_post.xml'); } - public function delete_post_data() + public static function delete_post_data() { $info_data = array( 'topic_first_post_id' => 1, diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index f698e88033..1ae4c5ae8e 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data return $this->createXMLDataSet(__DIR__ . '/fixtures/get_forums_visibility_sql.xml'); } - public function get_forums_visibility_sql_data() + public static function get_forums_visibility_sql_data() { return array( array( diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 897bcad3e6..198556132f 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data return $this->createXMLDataSet(__DIR__ . '/fixtures/get_forums_visibility_sql.xml'); } - public function get_global_visibility_sql_data() + public static function get_global_visibility_sql_data() { return array( array( diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index 8dafc522aa..42f36a3c4d 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -18,7 +18,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te return $this->createXMLDataSet(__DIR__ . '/fixtures/get_visibility_sql.xml'); } - public function get_visibility_sql_data() + public static function get_visibility_sql_data() { return array( // data set 0: display_unapproved_posts=false, moderator, can see all posts diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index e3fc946fbd..4191402de7 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t return $this->createXMLDataSet(__DIR__ . '/fixtures/set_post_visibility.xml'); } - public function set_post_visibility_data() + public static function set_post_visibility_data() { return array( array( @@ -155,7 +155,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t } } - public function set_post_soft_deleted_data() + public static function set_post_soft_deleted_data() { return array( array( diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 447ae9e1d8..491901cde0 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -21,7 +21,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ return $this->createXMLDataSet(__DIR__ . '/fixtures/set_topic_visibility.xml'); } - public function set_topic_visibility_data() + public static function set_topic_visibility_data() { return array( array( diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 0cd52b7d8b..61fd9bf3cb 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -79,7 +79,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return ''; } @@ -166,36 +166,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $this->root_path = $this->get_phpbb_root_path(); } - public function helper_url_data_no_rewrite() + public static function helper_url_data_no_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -229,36 +229,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); } - public function helper_url_data_with_rewrite() + public static function helper_url_data_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -292,36 +292,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); } - public function helper_url_data_absolute() + public static function helper_url_data_absolute() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, 'http://localhost/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -355,7 +355,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); } - public function helper_url_data_relative_path() + public static function helper_url_data_relative_path() { return array( array('controller2', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), @@ -418,36 +418,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); } - public function helper_url_data_network() + public static function helper_url_data_network() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '//localhost/' . static::path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -481,36 +481,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); } - public function helper_url_data_absolute_with_rewrite() + public static function helper_url_data_absolute_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, 'http://localhost/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -544,7 +544,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); } - public function helper_url_data_relative_path_with_rewrite() + public static function helper_url_data_relative_path_with_rewrite() { return array( array('controller2', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), @@ -604,36 +604,36 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); } - public function helper_url_data_network_with_rewrite() + public static function helper_url_data_network_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . static::path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . static::path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . static::path_to_app() . 'foo/bar/p-3', 'no params using empty array'), // Resolves DI parameters - array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + array('controller4', array(), true, false, '//localhost/' . static::path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), ); } @@ -667,7 +667,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); } - public function helper_url_data_force_server_vars() + public static function helper_url_data_force_server_vars() { return array( array(false, true, 'my_server', 443, '/my/board', 'http://', UrlGeneratorInterface::ABSOLUTE_URL, 'http://my_server:443/my/board/app.php/foo'), diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 03d8e89d87..58e1566a04 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -102,7 +102,7 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->assertEquals(array(), $resolver->getArguments($symfony_request, $resolver->getController($symfony_request))); } - public function data_get_arguments() + public static function data_get_arguments() { return array( array(array(new foo\controller(), 'handle2'), array('foo', 0)), diff --git a/tests/controller/helper_route_other_app.php b/tests/controller/helper_route_other_app.php index 2ee291efcf..8e9a9ac0af 100644 --- a/tests/controller/helper_route_other_app.php +++ b/tests/controller/helper_route_other_app.php @@ -30,7 +30,7 @@ class phpbb_controller_helper_route_other_app_test extends phpbb_controller_comm return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return 'foo/'; } diff --git a/tests/controller/helper_route_slash_test.php b/tests/controller/helper_route_slash_test.php index 5a37d3220f..1827bc0415 100644 --- a/tests/controller/helper_route_slash_test.php +++ b/tests/controller/helper_route_slash_test.php @@ -35,7 +35,7 @@ class phpbb_controller_helper_route_slash_test extends phpbb_controller_common_h return 'app.php'; } - protected function path_to_app() + protected static function path_to_app() { return 'phpBB/'; } diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 500f90a3fb..5fbb3fae63 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../mock/lang.php'; class phpbb_datetime_from_format_test extends phpbb_test_case { - public function from_format_data() + public static function from_format_data() { return array( array( @@ -58,7 +58,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case $this->assertEquals($expected, $user->format_date($timestamp, $format, true)); } - public function relative_format_date_data() + public static function relative_format_date_data() { // If the current time is too close to the testing time, // the relative time will use "x minutes ago" instead of "today ..." diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 2d5daa298c..5950c5e920 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -51,7 +51,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'); } - public function exists_data_acp() + public static function exists_data_acp() { return array( // Test the existing category @@ -184,7 +184,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $this->assertEquals($expected, $this->tool->exists('acp', $parent, $module, $lazy)); } - public function exists_data_ucp() + public static function exists_data_ucp() { return array( // Test the existing category diff --git a/tests/dbal/migrator_tool_permission_role_test.php b/tests/dbal/migrator_tool_permission_role_test.php index dc180dc154..2964189b49 100644 --- a/tests/dbal/migrator_tool_permission_role_test.php +++ b/tests/dbal/migrator_tool_permission_role_test.php @@ -102,7 +102,7 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ $this->auth_admin = new \auth_admin(); } - public function data_test_new_role_exists() + public static function data_test_new_role_exists() { return [ ['ROLE_ADMIN_NEW', true], @@ -119,7 +119,7 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ $this->assertEquals($expected, (bool) $this->tool->role_exists($role_name)); } - public function data_test_permission_assign_new_roles() + public static function data_test_permission_assign_new_roles() { return [ [ diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index e1ea2e7b51..d9c700a490 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -45,7 +45,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case $this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx); } - public function exists_data() + public static function exists_data() { return array( array( @@ -170,7 +170,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case $this->assertFalse($this->tool->exists('global_test', true)); } - public function data_test_permission_set() + public static function data_test_permission_set() { return array( array( @@ -226,7 +226,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case } } - public function data_test_permission_role_exists() + public static function data_test_permission_role_exists() { return array( array('ROLE_MOD_FULL', true), diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 141ee03a14..2318a54911 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -18,7 +18,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/three_users.xml'); } - public function return_on_error_select_data() + public static function return_on_error_select_data() { return array( array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), @@ -45,7 +45,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function fetchrow_data() + public static function fetchrow_data() { return array( array('', array(array('username_clean' => 'barfoo'), @@ -96,7 +96,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function fetchfield_data() + public static function fetchfield_data() { return array( array('', array('barfoo', 'foobar', 'bertie')), @@ -126,7 +126,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - static public function fetchfield_seek_data() + public static function fetchfield_seek_data() { return array( array(1, 'foobar'), @@ -152,7 +152,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $field); } - static public function query_limit_data() + public static function query_limit_data() { return array( array(0, 0, array(array('username_clean' => 'barfoo'), @@ -193,7 +193,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } - public function like_expression_data() + public static function like_expression_data() { // * = any_char; # = one_char return array( @@ -230,7 +230,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function not_like_expression_data() + public static function not_like_expression_data() { // * = any_char; # = one_char return array( @@ -290,7 +290,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function in_set_data() + public static function in_set_data() { return array( array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))), @@ -364,7 +364,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function build_array_data() + public static function build_array_data() { return array( array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))), diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index f94aebd85b..79fbffd1dc 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -18,7 +18,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/config.xml'); } - public function build_array_insert_data() + public static function build_array_insert_data() { return array( array(array( @@ -167,7 +167,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case $db->sql_freeresult($result); } - public function update_data() + public static function update_data() { return array( array( diff --git a/tests/email/email_parsing_test.php b/tests/email/email_parsing_test.php index fc1d1ef3be..7ad6e64e6e 100644 --- a/tests/email/email_parsing_test.php +++ b/tests/email/email_parsing_test.php @@ -146,7 +146,7 @@ class phpbb_email_parsing_test extends phpbb_test_case $this->reflection_template_property->setAccessible(true); } - public function email_parsing_data() + public static function email_parsing_data() { return array( array('Author username', 'Any forum', 'The topic title', 'Dear user'), diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php index 1ea9ef4e08..0520d9fbaa 100644 --- a/tests/event/exception_listener_test.php +++ b/tests/event/exception_listener_test.php @@ -13,7 +13,7 @@ class exception_listener_test extends phpbb_test_case { - public function phpbb_exception_data() + public static function phpbb_exception_data() { return array( array( diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php index 3011634c4b..7dc8c1a45c 100644 --- a/tests/extension/extension_base_test.php +++ b/tests/extension/extension_base_test.php @@ -58,7 +58,7 @@ class phpbb_extension_extension_base_test extends phpbb_test_case $container); } - public function data_test_suffix_get_classes() + public static function data_test_suffix_get_classes() { return array( array( diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index bd25b6caf9..066cc9b84d 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -57,7 +57,7 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } - public function set_extensions_data() + public static function set_extensions_data() { return array( array( diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index b32b67c124..b1468f3f9d 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -163,7 +163,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->assertEquals($metadata, $json); } - public function validator_non_existing_data() + public static function validator_non_existing_data() { return array( array('name'), @@ -223,7 +223,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } } - public function validator_invalid_data() + public static function validator_invalid_data() { return array( array('name', 'asdf'), @@ -281,7 +281,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } } - public function validator_requirements_data() + public static function validator_requirements_data() { return array( array( diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index 7d41b975a7..65e4fcdd33 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -174,7 +174,7 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); } - public function module_auth_test_data() + public static function module_auth_test_data() { return array( // module_auth, expected result diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php index 33ffde6bcb..34a577a0f9 100644 --- a/tests/feed/attachments_base_test.php +++ b/tests/feed/attachments_base_test.php @@ -76,7 +76,7 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case ); } - public function data_fetch_attachments() + public static function data_fetch_attachments() { return array( array(array(0), array(0)), diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php index 877c4c98e2..2f18313eb4 100644 --- a/tests/files/types_base_test.php +++ b/tests/files/types_base_test.php @@ -54,7 +54,7 @@ class phpbb_files_types_base_test extends phpbb_test_case $this->factory = new \phpbb\files\factory($this->container); } - public function data_check_upload_size() + public static function data_check_upload_size() { return array( array('foo', '500KB', array()), diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php index dd9ad7280c..f46be3a715 100644 --- a/tests/files/types_form_test.php +++ b/tests/files/types_form_test.php @@ -71,7 +71,7 @@ class phpbb_files_types_form_test extends phpbb_test_case $this->phpbb_root_path = $phpbb_root_path; } - public function data_upload_form() + public static function data_upload_form() { return array( array( diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php index e4cfd49064..ea1fa23ecb 100644 --- a/tests/files/types_local_test.php +++ b/tests/files/types_local_test.php @@ -96,7 +96,7 @@ class phpbb_files_types_local_test extends phpbb_test_case $this->assertInstanceOf('\phpbb\files\filespec', $file); } - public function data_upload_form() + public static function data_upload_form() { return array( array( diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index 1fda63e453..ab88b1cd83 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -96,7 +96,7 @@ class phpbb_files_upload_test extends phpbb_test_case $this->assertFalse($upload->is_valid('foobar')); } - public function data_internal_error() + public static function data_internal_error() { return array( array(UPLOAD_ERR_INI_SIZE, 'PHP_SIZE_OVERRUN'), diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index f64d306d90..8ed5519f31 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - public function clean_path_data() + public static function clean_path_data() { return array( array('foo', 'foo'), diff --git a/tests/filesystem/helper_clean_path_test.php b/tests/filesystem/helper_clean_path_test.php index c0c8783321..cfaf1df5cb 100644 --- a/tests/filesystem/helper_clean_path_test.php +++ b/tests/filesystem/helper_clean_path_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_helper_clean_path_test extends phpbb_test_case parent::setUp(); } - public function clean_path_data() + public static function clean_path_data() { yield ['foo', 'foo']; yield ['foo/bar', 'foo/bar']; diff --git a/tests/filesystem/helper_is_absolute_test.php b/tests/filesystem/helper_is_absolute_test.php index 954cf6a30b..d3d05921c9 100644 --- a/tests/filesystem/helper_is_absolute_test.php +++ b/tests/filesystem/helper_is_absolute_test.php @@ -21,7 +21,7 @@ class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case parent::setUp(); } - static public function is_absolute_data() + public static function is_absolute_data() { // Empty yield ['', false]; diff --git a/tests/filesystem/helper_realpath_test.php b/tests/filesystem/helper_realpath_test.php index 2f28909a82..848a855a4d 100644 --- a/tests/filesystem/helper_realpath_test.php +++ b/tests/filesystem/helper_realpath_test.php @@ -30,7 +30,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case parent::setUp(); } - public function realpath_resolve_absolute_without_symlinks_data() + public static function realpath_resolve_absolute_without_symlinks_data() { // Constant data yield [__DIR__, __DIR__]; @@ -42,7 +42,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case yield [__FILE__ . '../', false]; } - public function realpath_resolve_relative_without_symlinks_data() + public static function realpath_resolve_relative_without_symlinks_data() { if (!function_exists('getcwd')) { diff --git a/tests/filesystem/is_absolute_test.php b/tests/filesystem/is_absolute_test.php index 165130ae85..684fc38684 100644 --- a/tests/filesystem/is_absolute_test.php +++ b/tests/filesystem/is_absolute_test.php @@ -23,7 +23,7 @@ class phpbb_filesystem_is_absolute_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - static public function is_absolute_data() + public static function is_absolute_data() { return array( // Empty diff --git a/tests/filesystem/realpath_test.php b/tests/filesystem/realpath_test.php index 17281191d0..8119541844 100644 --- a/tests/filesystem/realpath_test.php +++ b/tests/filesystem/realpath_test.php @@ -34,7 +34,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); } - public function realpath_resolve_absolute_without_symlinks_data() + public static function realpath_resolve_absolute_without_symlinks_data() { return array( // Constant data @@ -49,7 +49,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case ); } - public function realpath_resolve_relative_without_symlinks_data() + public static function realpath_resolve_relative_without_symlinks_data() { if (!function_exists('getcwd')) { diff --git a/tests/functional/acp_bbcodes_test.php b/tests/functional/acp_bbcodes_test.php index dd0d356a58..07ef3b444c 100644 --- a/tests/functional/acp_bbcodes_test.php +++ b/tests/functional/acp_bbcodes_test.php @@ -65,7 +65,7 @@ class phpbb_functional_acp_bbcodes_test extends phpbb_functional_test_case $this->assertStringContainsString($error, $text); } - public function get_bbcode_error_tests() + public static function get_bbcode_error_tests() { return [ [ diff --git a/tests/functional/acp_groups_test.php b/tests/functional/acp_groups_test.php index 34cb16b99a..3c6d228e87 100644 --- a/tests/functional/acp_groups_test.php +++ b/tests/functional/acp_groups_test.php @@ -25,7 +25,7 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_te return 'adm/index.php?i=groups&mode=manage&action=edit'; } - public function acp_group_test_data() + public static function acp_group_test_data() { return array( 'both_yes' => array( diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php index 39ecbf99e2..fb092a7ff1 100644 --- a/tests/functional/acp_permissions_test.php +++ b/tests/functional/acp_permissions_test.php @@ -48,7 +48,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case $this->assertStringContainsString($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); } - public function permissions_data() + public static function permissions_data() { return array( // description diff --git a/tests/functional/acp_profile_field_test.php b/tests/functional/acp_profile_field_test.php index 9730e1e385..7413c34980 100644 --- a/tests/functional/acp_profile_field_test.php +++ b/tests/functional/acp_profile_field_test.php @@ -25,7 +25,7 @@ class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case $this->add_lang('acp/profile'); } - public function data_add_profile_field() + public static function data_add_profile_field() { return array( array('profilefields.type.bool', diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 1ba5dc744f..6bdef1c499 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5'; } - public function avatar_acp_groups_data() + public static function avatar_acp_groups_data() { return array( // Correct Gravatar diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php index e35e1a8011..d674495dd3 100644 --- a/tests/functional/avatar_acp_users_test.php +++ b/tests/functional/avatar_acp_users_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava return 'adm/index.php?i=acp_users&u=2&mode=avatar'; } - public function avatar_acp_users_data() + public static function avatar_acp_users_data() { return array( // Gravatar with incorrect email diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php index a3abe59682..800c98ecf1 100644 --- a/tests/functional/avatar_ucp_groups_test.php +++ b/tests/functional/avatar_ucp_groups_test.php @@ -22,7 +22,7 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5'; } - public function avatar_ucp_groups_data() + public static function avatar_ucp_groups_data() { return array( // Gravatar with incorrect email diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php index e004bcd166..60e0ea8a63 100644 --- a/tests/functional/avatar_ucp_users_test.php +++ b/tests/functional/avatar_ucp_users_test.php @@ -23,7 +23,7 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava return 'ucp.php?i=ucp_profile&mode=avatar'; } - public function avatar_ucp_groups_data() + public static function avatar_ucp_groups_data() { return array( // Gravatar with correct settings diff --git a/tests/functional/common_groups_test_case.php b/tests/functional/common_groups_test_case.php index 0b0ffd9331..d3ee795c3b 100644 --- a/tests/functional/common_groups_test_case.php +++ b/tests/functional/common_groups_test_case.php @@ -57,7 +57,7 @@ abstract class phpbb_functional_common_groups_test_case extends phpbb_functional $this->assertStringContainsString($this->lang('CONFIG_UPDATED'), $crawler->text()); } - public function groups_manage_test_data() + public static function groups_manage_test_data() { return array( array('', 'GROUP_UPDATED'), diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 30dcaa89c7..bcc299fae5 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -255,6 +255,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(); $form['minimum_stability']->select('dev'); + $form['enable_packagist']->select('1'); $form['repositories'] = 'https://satis.phpbb.com/'; $crawler = self::submit($form); $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('div[class="successbox"] > p')->text()); diff --git a/tests/functional/forum_password_test.php b/tests/functional/forum_password_test.php index 4b2b69a92c..93c0dbb6d6 100644 --- a/tests/functional/forum_password_test.php +++ b/tests/functional/forum_password_test.php @@ -34,7 +34,7 @@ class phpbb_functional_forum_password_test extends phpbb_functional_test_case $crawler = self::submit($form); } - public function data_enter_forum_with_password() + public static function data_enter_forum_with_password() { return array( array('foowrong', 'WRONG_PASSWORD'), diff --git a/tests/functional/mcp/mcp_main_test.php b/tests/functional/mcp/mcp_main_test.php index a056217f73..7f092e1f00 100644 --- a/tests/functional/mcp/mcp_main_test.php +++ b/tests/functional/mcp/mcp_main_test.php @@ -72,7 +72,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case return $post; } - public function mcp_view_forum_actions_data() + public static function mcp_view_forum_actions_data() { // action, success message, require_confirmation return [ @@ -181,7 +181,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case $this->assertStringContainsString($this->lang('TOPICS_DELETED_SUCCESS'), $crawler->filter('#message p')->text()); } - public function mcp_view_topic_actions_data() + public static function mcp_view_topic_actions_data() { // action, success message, require_confirmation return [ diff --git a/tests/functional/permission_roles_test.php b/tests/functional/permission_roles_test.php index e6506fb37c..5cc6491e4b 100644 --- a/tests/functional/permission_roles_test.php +++ b/tests/functional/permission_roles_test.php @@ -16,7 +16,7 @@ */ class functional_permission_roles_test extends phpbb_functional_test_case { - public function data_permission_roles() + public static function data_permission_roles() { return array( array( diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index 7952d4f17b..2883642bf2 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -60,7 +60,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case } } - public function get_urls() + public static function get_urls() { return array( array('posting.php?mode=reply&t=1'), diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 9f8b299756..f561a9618c 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -301,7 +301,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case ); } - public function nonexistent_post_id_data() + public static function nonexistent_post_id_data() { $nonexistent_post_id = 999999; // Random value return [ diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index cf0f903817..e2efccc9b0 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -102,7 +102,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $this->login(self::TEST_USER); } - public function data_reset_user_password() + public static function data_reset_user_password() { return [ ['RESET_TOKEN_EXPIRED_OR_INVALID', 0, 'abcdef'], diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 6e1fc57306..da38cae635 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -15,13 +15,16 @@ class phpbb_build_url_test extends phpbb_test_case { protected function setUp(): void { - global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper; + global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper, $config; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); $user = new phpbb_mock_user(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $config = new \phpbb\config\config([ + 'enable_mod_rewrite' => 0, + ]); $phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( @@ -33,7 +36,7 @@ class phpbb_build_url_test extends phpbb_test_case ); $phpbb_container->set('path_helper', $phpbb_path_helper); } - public function build_url_test_data() + public static function build_url_test_data() { return array( array( @@ -79,8 +82,9 @@ class phpbb_build_url_test extends phpbb_test_case */ public function test_build_url($page, $strip_vars, $expected) { - global $user; + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher, $_SID; + $_SID = ''; $user->page['page'] = $page; $output = build_url($strip_vars); diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index e88da592a7..f3fbda79d9 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -13,7 +13,7 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case { - public function convert_30_dbms_to_31_data() + public static function convert_30_dbms_to_31_data() { return array( array('mssql_odbc'), diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php index b23c38854b..3b531398ad 100644 --- a/tests/functions/generate_string_list.php +++ b/tests/functions/generate_string_list.php @@ -29,7 +29,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case $this->user->add_lang('common'); } - public function generate_string_list_data() + public static function generate_string_list_data() { return array( array( diff --git a/tests/functions/get_formatted_filesize_test.php b/tests/functions/get_formatted_filesize_test.php index 290515b64f..d2a94453f6 100644 --- a/tests/functions/get_formatted_filesize_test.php +++ b/tests/functions/get_formatted_filesize_test.php @@ -13,7 +13,7 @@ class phpbb_get_formatted_filesize_test extends phpbb_test_case { - public function get_formatted_filesize_test_data() + public static function get_formatted_filesize_test_data() { return array( // exact powers of 2 diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php index b8254b03ea..5b98d70646 100644 --- a/tests/functions/get_preg_expression_test.php +++ b/tests/functions/get_preg_expression_test.php @@ -13,7 +13,7 @@ class phpbb_functions_get_preg_expression_test extends phpbb_test_case { - public function data_path_remove_dot_trailing_slash() + public static function data_path_remove_dot_trailing_slash() { return array( array('./../', '$2', '/..'), diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php index 47b9edcdbb..5b19f66e8e 100644 --- a/tests/functions/make_clickable_email_test.php +++ b/tests/functions/make_clickable_email_test.php @@ -17,7 +17,11 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case { parent::setUp(); - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $config; + $config = new \phpbb\config\config([ + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user(); $request = new phpbb_mock_request(); $symfony_request = new \phpbb\symfony_request($request); @@ -26,7 +30,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case /** * 'e' tag for email addresses html **/ - public function data_test_make_clickable_email_positive() + public static function data_test_make_clickable_email_positive() { return array( array( @@ -147,7 +151,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case ); } - public function data_test_make_clickable_email_negative() + public static function data_test_make_clickable_email_negative() { return array( array('foo.example.com'), // @ is missing @@ -206,6 +210,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case */ public function test_email_matching_positive($email, $expected) { + global $config, $user, $request, $symfony_request; $this->assertSame($expected, make_clickable($email)); } @@ -214,6 +219,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case */ public function test_email_matching_negative($email, $expected = null) { + global $config, $user, $request, $symfony_request; $expected = ($expected) ?: $email; $this->assertSame($expected, make_clickable($email)); } diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php index 5b24696460..443b78b3a4 100644 --- a/tests/functions/make_clickable_test.php +++ b/tests/functions/make_clickable_test.php @@ -25,7 +25,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case * "postlink" for the rest of URLs * empty for email addresses **/ - public function data_test_make_clickable_url_positive() + public static function data_test_make_clickable_url_positive() { return [ [ @@ -82,7 +82,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_url_idn() + public static function data_test_make_clickable_url_idn() { return [ [ @@ -135,7 +135,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_local_url_idn() + public static function data_test_make_clickable_local_url_idn() { return [ [ @@ -154,7 +154,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ]; } - public function data_test_make_clickable_custom_classes() + public static function data_test_make_clickable_custom_classes() { return [ [ @@ -200,7 +200,11 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case { parent::setUp(); - global $user, $request, $symfony_request; + global $user, $request, $symfony_request, $config; + $config = new \phpbb\config\config([ + 'force_server_vars' => 0, + 'server_name' => 'testhost', + ]); $user = new phpbb_mock_user(); $request = new phpbb_mock_request(); $symfony_request = new \phpbb\symfony_request($request); @@ -212,6 +216,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_urls_matching_positive($url, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url)); } @@ -220,6 +225,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_local_urls_matching_idn($url, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url, "http://www.домен.рф")); } @@ -228,6 +234,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case */ public function test_make_clickable_custom_classes($url, $server_url, $class, $expected) { + global $user, $request, $symfony_request, $config; $this->assertSame($expected, make_clickable($url, $server_url, $class)); } } diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 1a2d000d0d..2beb14d826 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -33,7 +33,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case ); } - static public function obtain_guest_count_data() + public static function obtain_guest_count_data() { return array( array(0, 2), @@ -53,7 +53,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $this->assertEquals($expected, obtain_guest_count($forum_id)); } - static public function obtain_users_online_data() + public static function obtain_users_online_data() { return array( array(0, false, array( @@ -123,7 +123,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $this->assertEquals($expected, obtain_users_online($forum_id)); } - static public function obtain_users_online_string_data() + public static function obtain_users_online_string_data() { return array( array(0, false, array( diff --git a/tests/functions/parse_cfg_file_test.php b/tests/functions/parse_cfg_file_test.php index 22c7c17f68..0ac63a13a3 100644 --- a/tests/functions/parse_cfg_file_test.php +++ b/tests/functions/parse_cfg_file_test.php @@ -13,7 +13,7 @@ class phpbb_functions_parse_cfg_file_test extends phpbb_test_case { - public function parse_cfg_file_data() + public static function parse_cfg_file_data() { return array( array( diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php index 6aaa5f8641..b0c0307d84 100644 --- a/tests/functions/phpbb_get_banned_user_ids.php +++ b/tests/functions/phpbb_get_banned_user_ids.php @@ -61,7 +61,7 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case $phpbb_container->set('ban.manager', $ban_manager); } - public function phpbb_get_banned_user_ids_data() + public static function phpbb_get_banned_user_ids_data() { return array( // Input to phpbb_get_banned_user_ids (user_id list, ban_end) diff --git a/tests/functions/phpbb_get_install_redirect_test.php b/tests/functions/phpbb_get_install_redirect_test.php index 22b9ade589..3b3b65f964 100644 --- a/tests/functions/phpbb_get_install_redirect_test.php +++ b/tests/functions/phpbb_get_install_redirect_test.php @@ -13,7 +13,7 @@ class phpbb_get_install_redirect_test extends phpbb_test_case { - public function data_redirect(): array + public static function data_redirect(): array { return [ [ diff --git a/tests/functions/quoteattr_test.php b/tests/functions/quoteattr_test.php index dbad7a99d8..a84ad17483 100644 --- a/tests/functions/quoteattr_test.php +++ b/tests/functions/quoteattr_test.php @@ -13,7 +13,7 @@ class phpbb_quoteattr_test extends phpbb_test_case { - public function quoteattr_test_data() + public static function quoteattr_test_data() { return array( array('foo', null, '"foo"'), diff --git a/tests/functions/short_ipv6__test.php b/tests/functions/short_ipv6__test.php index 8fa9cd7420..d62f652746 100644 --- a/tests/functions/short_ipv6__test.php +++ b/tests/functions/short_ipv6__test.php @@ -13,7 +13,7 @@ class short_ipv6__test extends phpbb_test_case { - public function data_short_ipv6(): array + public static function data_short_ipv6(): array { return [ ['::1', 0, ''], diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php index aadacadb02..b3b4b42598 100644 --- a/tests/functions/style_select_test.php +++ b/tests/functions/style_select_test.php @@ -18,7 +18,7 @@ class phpbb_functions_style_select_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__.'/fixtures/style_select.xml'); } - static public function style_select_data() + public static function style_select_data() { return [ [ diff --git a/tests/functions/validate_hex_colour_test.php b/tests/functions/validate_hex_colour_test.php index 467bcd1d89..c82cce140b 100644 --- a/tests/functions/validate_hex_colour_test.php +++ b/tests/functions/validate_hex_colour_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; class phpbb_functions_validate_hex_colour_test extends phpbb_test_case { - public function positive_match_data() + public static function positive_match_data() { return array( array('a00'), @@ -27,7 +27,7 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // Invalid prefix @@ -53,7 +53,7 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function optional_only_data() + public static function optional_only_data() { return array( // The empty colour, i.e. "no colour". @@ -61,19 +61,19 @@ class phpbb_functions_validate_hex_colour_test extends phpbb_test_case ); } - public function strict_negative_match_data() + public static function strict_negative_match_data() { return array_merge( - $this->negative_match_data(), - $this->optional_only_data() + self::negative_match_data(), + self::optional_only_data() ); } - public function nonstrict_positive_match_data() + public static function nonstrict_positive_match_data() { return array_merge( - $this->positive_match_data(), - $this->optional_only_data() + self::positive_match_data(), + self::optional_only_data() ); } diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index bf74cb30fb..56be2b6441 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -25,7 +25,7 @@ class phpbb_functions_validate_password_test extends phpbb_test_case $this->helper = new phpbb_functions_validate_data_helper($this); } - public function validate_password_data() + public static function validate_password_data() { return array( array('PASS_TYPE_ANY', array( diff --git a/tests/functions/validate_user_email_test.php b/tests/functions/validate_user_email_test.php index a43244bd50..e1f8526e21 100644 --- a/tests/functions/validate_user_email_test.php +++ b/tests/functions/validate_user_email_test.php @@ -28,12 +28,14 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case protected function setUp(): void { - global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx; + global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $config; parent::setUp(); $phpbb_container = new phpbb_mock_container_builder(); - $config = new \phpbb\config\config([]); + $config = new \phpbb\config\config([ + 'allow_emailreuse' => 0, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -99,6 +101,8 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case */ public function test_validate_user_email($case, $errors, $email) { + global $config, $db, $user; + $this->set_validation_prerequisites(false); $this->helper->assert_valid_data(array( @@ -124,6 +128,8 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case */ public function test_validate_user_email_mx($case, $errors, $email) { + global $config, $db, $user; + $this->set_validation_prerequisites(true); $this->helper->assert_valid_data(array( diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index 7c0327eaf6..0da6b99a6c 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -35,7 +35,7 @@ class phpbb_functions_validate_username_test extends phpbb_database_test_case $this->helper = new phpbb_functions_validate_data_helper($this); } - public function validate_username_data() + public static function validate_username_data() { return array( array('USERNAME_CHARS_ANY', array( diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index bdb2bb36e4..4ddd891f81 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case { - public function build_cfg_template_text_data() + public static function build_cfg_template_text_data() { return array( array( @@ -84,7 +84,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_dimension_data() + public static function build_cfg_template_dimension_data() { return array( array( @@ -154,7 +154,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_number_data() + public static function build_cfg_template_number_data() { return array( array( @@ -222,7 +222,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_textarea_data() + public static function build_cfg_template_textarea_data() { return array( array( @@ -257,7 +257,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_radio_data() + public static function build_cfg_template_radio_data() { return [ [ @@ -492,7 +492,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_append_data() + public static function build_cfg_template_append_data() { return array( array( @@ -528,7 +528,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, phpbb_build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } - public function build_cfg_template_select_data() + public static function build_cfg_template_select_data() { return [ [ diff --git a/tests/functions_acp/build_select_test.php b/tests/functions_acp/build_select_test.php index 3f061a18c8..693eabe3c9 100644 --- a/tests/functions_acp/build_select_test.php +++ b/tests/functions_acp/build_select_test.php @@ -25,7 +25,7 @@ class phpbb_functions_acp_build_select_test extends phpbb_test_case $user->lang = new phpbb_mock_lang(); } - public function build_select_data() + public static function build_select_data() { return array( array( diff --git a/tests/functions_acp/insert_config_array_test.php b/tests/functions_acp/insert_config_array_test.php index bf71b4e32f..f61b6dceac 100644 --- a/tests/functions_acp/insert_config_array_test.php +++ b/tests/functions_acp/insert_config_array_test.php @@ -27,7 +27,7 @@ class phpbb_functions_insert_config_array_test extends phpbb_test_case ); } - public function insert_config_array_data() + public static function insert_config_array_data() { return array( array( // Add a new config after 1st array item diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php index c1b4eb60e4..a94e9b1405 100644 --- a/tests/functions_acp/validate_config_vars_test.php +++ b/tests/functions_acp/validate_config_vars_test.php @@ -29,7 +29,7 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case /** * Data sets that don't throw an error. */ - public function validate_config_vars_fit_data() + public static function validate_config_vars_fit_data() { return array( array( @@ -86,7 +86,7 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case /** * Data sets that throw the error. */ - public function validate_config_vars_error_data() + public static function validate_config_vars_error_data() { return array( array( diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index 8e59011829..16891d936b 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -28,7 +28,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that don't throw an error. */ - public function validate_range_data_fit() + public static function validate_range_data_fit() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => 0))), @@ -74,7 +74,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_LOW-error. */ - public function validate_range_data_too_low() + public static function validate_range_data_too_low() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => -1))), @@ -109,7 +109,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_BIG-error. */ - public function validate_range_data_too_big() + public static function validate_range_data_too_big() { return array( array(array(array('column_type' => 'BOOL', 'lang' => 'TEST', 'value' => 2))), @@ -144,7 +144,7 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case /** * Data sets that throw the SETTING_TOO_LONG-error. */ - public function validate_range_data_too_long() + public static function validate_range_data_too_long() { return array( array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat('a', 256)))), diff --git a/tests/functions_content/get_context_test.php b/tests/functions_content/get_context_test.php index 3c9dcf3c8d..0b98018aab 100644 --- a/tests/functions_content/get_context_test.php +++ b/tests/functions_content/get_context_test.php @@ -20,7 +20,7 @@ class phpbb_functions_content_get_context_test extends TestCase * * @return array */ - public function data_get_context(): array + public static function data_get_context(): array { return [ 'text contains words and length greater than text' => [ @@ -121,7 +121,7 @@ class phpbb_functions_content_get_context_test extends TestCase * * @return array */ - public function data_get_context_unicode(): array + public static function data_get_context_unicode(): array { return [ 'text contains words and length greater than text unicode' => [ diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php index 94ac99f272..3abd10be5c 100644 --- a/tests/functions_content/get_username_string_test.php +++ b/tests/functions_content/get_username_string_test.php @@ -30,7 +30,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $user->lang['GUEST'] = 'Guest'; } - public function get_username_string_profile_data() + public static function get_username_string_profile_data() { global $phpbb_root_path, $phpEx; @@ -49,7 +49,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('profile', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_username_data() + public static function get_username_string_username_data() { return array( array(ANONYMOUS, '', '', false, false, 'Guest'), @@ -68,7 +68,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('username', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_colour_data() + public static function get_username_string_colour_data() { return array( array(0, '', '', false, false, ''), @@ -86,7 +86,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('colour', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_full_data() + public static function get_username_string_full_data() { global $phpbb_root_path, $phpEx; @@ -107,7 +107,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case $this->assertEquals($expected, get_username_string('full', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); } - public function get_username_string_no_profile_data() + public static function get_username_string_no_profile_data() { return array( array(ANONYMOUS, 'Anonymous', '', false, false, 'Anonymous'), diff --git a/tests/functions_content/phpbb_clean_search_string_test.php b/tests/functions_content/phpbb_clean_search_string_test.php index 34ae0575c5..0744fa1764 100644 --- a/tests/functions_content/phpbb_clean_search_string_test.php +++ b/tests/functions_content/phpbb_clean_search_string_test.php @@ -13,7 +13,7 @@ class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_case { - public function phpbb_clean_search_string_data() + public static function phpbb_clean_search_string_data() { return array( array('*', ''), diff --git a/tests/functions_content/phpbb_format_quote_test.php b/tests/functions_content/phpbb_format_quote_test.php index 04dc620c29..7156ea7317 100644 --- a/tests/functions_content/phpbb_format_quote_test.php +++ b/tests/functions_content/phpbb_format_quote_test.php @@ -31,7 +31,7 @@ class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case parent::setUp(); } - public function data_phpbb_format_quote() + public static function data_phpbb_format_quote() { return [ [true, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', '', "[quote=admin user_id=2][quote="username"]quoted[/quote][/quote]\n\n"], diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php index 9f4f69d0c2..a7bdcdfb2b 100644 --- a/tests/functions_user/delete_user_test.php +++ b/tests/functions_user/delete_user_test.php @@ -68,7 +68,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); } - public function first_last_post_data() + public static function first_last_post_data() { return array( array( @@ -227,7 +227,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function report_attachment_data() + public static function report_attachment_data() { return array( array( @@ -311,7 +311,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function delete_data() + public static function delete_data() { return array( array( @@ -397,7 +397,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case $this->db->sql_freeresult($result); } - public function delete_user_id_data() + public static function delete_user_id_data() { return array( array( diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 887c21d4ca..c0d884e4d8 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -20,7 +20,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes return $this->createXMLDataSet(__DIR__.'/fixtures/group_user_attributes.xml'); } - public function group_user_attributes_data() + public static function group_user_attributes_data() { return array( array( diff --git a/tests/functions_user/whois_test.php b/tests/functions_user/whois_test.php index 4dd72311bb..26793802d5 100644 --- a/tests/functions_user/whois_test.php +++ b/tests/functions_user/whois_test.php @@ -30,7 +30,7 @@ class phpbb_functions_user_whois_test extends phpbb_test_case ->getMock(); } - public function ips_data() + public static function ips_data() { return [ ['2001:4860:4860::8888'], // Google public DNS diff --git a/tests/group/helper_get_name_string_test.php b/tests/group/helper_get_name_string_test.php index 34dab1471d..154fcb2f62 100644 --- a/tests/group/helper_get_name_string_test.php +++ b/tests/group/helper_get_name_string_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_case { - public function get_name_string_profile_data() + public static function get_name_string_profile_data() { global $phpbb_root_path, $phpEx; @@ -35,7 +35,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('profile', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_group_name_data() + public static function get_name_string_group_name_data() { return array( // Should be fine @@ -57,7 +57,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('group_name', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_colour_data() + public static function get_name_string_colour_data() { return array( array(0, '', '', false, ''), @@ -75,7 +75,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('colour', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_full_data() + public static function get_name_string_full_data() { global $phpbb_root_path, $phpEx; @@ -95,7 +95,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca $this->assertEquals($expected, $this->group_helper->get_name_string('full', $group_id, $group_name, $group_colour, $custom_profile_url)); } - public function get_name_string_no_profile_data() + public static function get_name_string_no_profile_data() { return array( array(0, 'BOTS', '000000', false, 'Bots'), diff --git a/tests/group/helper_get_rank_test.php b/tests/group/helper_get_rank_test.php index 95dc2ae600..5d427b49ee 100644 --- a/tests/group/helper_get_rank_test.php +++ b/tests/group/helper_get_rank_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/helper_test_case.php'; class phpbb_group_helper_get_rank_test extends phpbb_group_helper_test_case { - public function get_rank_data() + public static function get_rank_data() { global $phpbb_root_path; diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php index 13c909b6e5..9381cd8b5f 100644 --- a/tests/groupposition/legend_test.php +++ b/tests/groupposition/legend_test.php @@ -18,7 +18,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/legend.xml'); } - public function get_group_value_data() + public static function get_group_value_data() { return array( array(1, 0, ''), @@ -57,7 +57,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals(2, $test_class->get_group_count()); } - public function add_group_data() + public static function add_group_data() { return array( array( @@ -101,7 +101,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_group_data() + public static function delete_group_data() { return array( array( @@ -187,7 +187,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_up_data() + public static function move_up_data() { return array( array( @@ -240,7 +240,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_down_data() + public static function move_down_data() { return array( array( @@ -293,7 +293,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_data() + public static function move_data() { return array( array( diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php index c8cfed6c49..5620099698 100644 --- a/tests/groupposition/teampage_test.php +++ b/tests/groupposition/teampage_test.php @@ -18,7 +18,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/fixtures/teampage.xml'); } - public function get_group_value_data() + public static function get_group_value_data() { return array( array(2, 3, ''), @@ -57,7 +57,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals(8, $test_class->get_group_count()); } - public function add_group_teampage_data() + public static function add_group_teampage_data() { return array( array( @@ -145,7 +145,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function add_category_teampage_data() + public static function add_category_teampage_data() { return array( array( @@ -186,7 +186,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_group_data() + public static function delete_group_data() { return array( array( @@ -251,7 +251,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function delete_teampage_data() + public static function delete_teampage_data() { return array( array( @@ -301,7 +301,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_data() + public static function move_data() { return array( array( @@ -462,7 +462,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case $this->assertEquals($expected, $db->sql_fetchrowset($result)); } - public function move_teampage_data() + public static function move_teampage_data() { return array( array( diff --git a/tests/help/manager_test.php b/tests/help/manager_test.php index e079d1e535..36b3fa4143 100644 --- a/tests/help/manager_test.php +++ b/tests/help/manager_test.php @@ -36,7 +36,7 @@ class phpbb_help_manager_test extends phpbb_test_case ); } - public function add_block_data() + public static function add_block_data() { return array( array('abc', false, array(), false), @@ -98,7 +98,7 @@ class phpbb_help_manager_test extends phpbb_test_case $this->assertEquals($switch_expected, $this->manager->switched_column()); } - public function add_question_data() + public static function add_question_data() { return array( array('question1', 'answer1'), diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php index 8fbf3bcc85..306a8c1926 100644 --- a/tests/installer/database_helper_test.php +++ b/tests/installer/database_helper_test.php @@ -76,7 +76,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Data provider for the remove comments function - public function comment_string_provider() + public static function comment_string_provider() { return array( array( @@ -99,7 +99,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Data provider for the sql file splitter function - public function sql_file_string_provider() + public static function sql_file_string_provider() { return array( array( @@ -116,7 +116,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case } // Test data for prefix test - public function prefix_test_case_provider() + public static function prefix_test_case_provider() { return array( array( diff --git a/tests/json/sanitizer_test.php b/tests/json/sanitizer_test.php index 267dcaf774..286d02d6f1 100644 --- a/tests/json/sanitizer_test.php +++ b/tests/json/sanitizer_test.php @@ -15,7 +15,7 @@ use phpbb\json\sanitizer as json_sanitizer; class phpbb_json_sanitizer_test extends phpbb_test_case { - public function data_decode() + public static function data_decode() { return [ [false, []], diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index 366d66ee0b..5383d3d04a 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -37,7 +37,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case parent::setUp(); } - public function log_delete_data() + public static function log_delete_data() { return array( array( diff --git a/tests/mcp/post_ip_test.php b/tests/mcp/post_ip_test.php index bd443892e1..1a8e9624b3 100644 --- a/tests/mcp/post_ip_test.php +++ b/tests/mcp/post_ip_test.php @@ -30,7 +30,7 @@ class phpbb_mcp_post_ip_test extends phpbb_database_test_case $this->db = $this->new_dbal(); } - public function data_get_num_ips() + public static function data_get_num_ips() { return array( array(2, 1), @@ -47,7 +47,7 @@ class phpbb_mcp_post_ip_test extends phpbb_database_test_case $this->assertSame($expected, phpbb_get_num_ips_for_poster($this->db, $poster_id)); } - public function data_get_num_posters() + public static function data_get_num_posters() { return array( array(2, '127.0.0.1'), diff --git a/tests/mention/controller_test.php b/tests/mention/controller_test.php index 803b2d2b6a..cef50af781 100644 --- a/tests/mention/controller_test.php +++ b/tests/mention/controller_test.php @@ -161,7 +161,7 @@ class phpbb_mention_controller_test extends phpbb_database_test_case $this->controller = new \phpbb\mention\controller\mention($mention_sources_array, $request, $phpbb_root_path, $phpEx); } - public function handle_data() + public static function handle_data() { /** * NOTE: diff --git a/tests/messenger/method_email_test.php b/tests/messenger/method_email_test.php index fe5c24808c..650cf28a4e 100644 --- a/tests/messenger/method_email_test.php +++ b/tests/messenger/method_email_test.php @@ -580,7 +580,7 @@ class phpbb_messenger_method_email_test extends \phpbb_test_case $this->method_email->send(); } - public function email_template_data(): array + public static function email_template_data(): array { return [ ['test'], diff --git a/tests/migrations/migrations_check_config_added_test.php b/tests/migrations/migrations_check_config_added_test.php index 5cde980cde..13d8b834a6 100644 --- a/tests/migrations/migrations_check_config_added_test.php +++ b/tests/migrations/migrations_check_config_added_test.php @@ -51,7 +51,7 @@ class migrations_check_config_added_test extends phpbb_test_case $this->schema_data = file_get_contents($phpbb_root_path . 'install/schemas/schema_data.sql'); } - public function get_config_options_from_migrations() + protected function get_config_names() { global $phpbb_root_path, $phpEx; @@ -154,18 +154,18 @@ class migrations_check_config_added_test extends phpbb_test_case // Drop configuration options which were removed by config.remove $config_names = array_diff_key($config_names, $config_removed); - return $config_names; + + return array_combine(array_column($config_names, 0), array_column($config_names, 1)); } - /** - * @dataProvider get_config_options_from_migrations - */ - public function test_config_option_exists_in_schema_data($config_name, $class) + public function test_config_option_exists_in_schema_data() { $message = 'Migration: %1$s, config_name: %2$s; not added to schema_data.sql'; - - $this->assertNotFalse(strpos($this->schema_data, $config_name), - sprintf($message, $class, $config_name) - ); + foreach ($this->get_config_names() as $config_name => $class) + { + $this->assertNotFalse(strpos($this->schema_data, $config_name), + sprintf($message, $class, $config_name) + ); + } } } diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php index f8a92c742a..47b85ccc1c 100644 --- a/tests/migrator/get_callable_from_step_test.php +++ b/tests/migrator/get_callable_from_step_test.php @@ -70,7 +70,7 @@ class get_callable_from_step_test extends phpbb_database_test_case return $this->createXMLDataSet(__DIR__ . '/../dbal/fixtures/migrator.xml'); } - public function get_callable_from_step_provider() + public static function get_callable_from_step_provider() { return array( array( diff --git a/tests/migrator/get_schema_steps_test.php b/tests/migrator/get_schema_steps_test.php index 9b5e6c6697..8c3e88209a 100644 --- a/tests/migrator/get_schema_steps_test.php +++ b/tests/migrator/get_schema_steps_test.php @@ -20,7 +20,7 @@ class get_schema_steps_test extends phpbb_test_case $this->helper = new \phpbb\db\migration\helper(); } - public function schema_provider() + public static function schema_provider() { return array( array( diff --git a/tests/migrator/reverse_update_data_test.php b/tests/migrator/reverse_update_data_test.php index 83ae8e780d..856cf12149 100644 --- a/tests/migrator/reverse_update_data_test.php +++ b/tests/migrator/reverse_update_data_test.php @@ -23,7 +23,7 @@ class reverse_update_data_test extends phpbb_test_case $this->helper = new \phpbb\db\migration\helper(); } - public function update_data_provider() + public static function update_data_provider() { return array( array( @@ -34,7 +34,7 @@ class reverse_update_data_test extends phpbb_test_case array('permission.add', array('some_data')), )), array('config.remove', array('foobar')), - array('custom', array(array($this, 'foo_bar'))), + array('custom', array(array(self::class, 'foo_bar'))), array('tool.method', array('test_data')), ), array( diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index 943029304f..b46882a0fb 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -68,7 +68,7 @@ class schema_generator_test extends phpbb_test_case $this->assertArrayHasKey('phpbb_users', $this->generator->get_schema()); } - public function column_add_after_data() + public static function column_add_after_data() { return array( array( diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index 559a880a7a..cccf189680 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -50,7 +50,7 @@ class guesser_test extends \phpbb_test_case $this->phpbb_root_path = $phpbb_root_path; } - public function data_guess_files() + public static function data_guess_files() { return array( array('image/gif', 'gif'), @@ -76,7 +76,7 @@ class guesser_test extends \phpbb_test_case $this->assertEquals($expected, $this->guesser->guess($this->path . '/../upload/fixture/' . $file)); } - public function data_guess_files_no_fileinfo() + public static function data_guess_files_no_fileinfo() { return array( array('application/octet-stream', 'gif'), @@ -112,7 +112,7 @@ class guesser_test extends \phpbb_test_case $this->assertEquals('application/octet-stream', $guesser->guess($this->jpg_file)); } - public function data_incorrect_guessers() + public static function data_incorrect_guessers() { return array( array(array(new \phpbb\mimetype\incorrect_guesser)), @@ -130,7 +130,7 @@ class guesser_test extends \phpbb_test_case $guesser = new \phpbb\mimetype\guesser($guessers); } - public function data_content_guesser() + public static function data_content_guesser() { return array( array( @@ -210,7 +210,7 @@ class guesser_test extends \phpbb_test_case $this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]); } - public function data_choose_mime_type() + public static function data_choose_mime_type() { return array( array('application/octet-stream', 'application/octet-stream', null), diff --git a/tests/mock/user.php b/tests/mock/user.php index 254c02f669..38d6bef2eb 100644 --- a/tests/mock/user.php +++ b/tests/mock/user.php @@ -24,6 +24,7 @@ class phpbb_mock_user public $style = []; public $data = []; public $lang = []; + public $ip = ''; private $options = array(); public function optionget($item, $data = false) diff --git a/tests/network/ip_normalise_test.php b/tests/network/ip_normalise_test.php index 52e594e115..e15c76af1d 100644 --- a/tests/network/ip_normalise_test.php +++ b/tests/network/ip_normalise_test.php @@ -13,7 +13,7 @@ class phpbb_network_ip_normalise_test extends phpbb_test_case { - public function data_provider() + public static function data_provider() { return array( // From: A Recommendation for IPv6 Address Text Representation diff --git a/tests/notification/notification_method_email_test.php b/tests/notification/notification_method_email_test.php index 0984967304..71ebffef89 100644 --- a/tests/notification/notification_method_email_test.php +++ b/tests/notification/notification_method_email_test.php @@ -178,7 +178,7 @@ class notification_method_email_test extends phpbb_tests_notification_base $this->notifications->set_var('notification_methods', $methods); } - public function data_notification_email() + public static function data_notification_email() { return [ /** diff --git a/tests/notification/notification_method_webpush_test.php b/tests/notification/notification_method_webpush_test.php index 7967a0f7c6..a1b7e6325e 100644 --- a/tests/notification/notification_method_webpush_test.php +++ b/tests/notification/notification_method_webpush_test.php @@ -231,7 +231,7 @@ class notification_method_webpush_test extends phpbb_tests_notification_base $this->notifications->set_var('notification_methods', $methods); } - public function data_notification_webpush() + public static function data_notification_webpush() { return [ /** @@ -656,7 +656,7 @@ class notification_method_webpush_test extends phpbb_tests_notification_base $this->assertCount(0, $cur_notifications, 'Assert that no notifications have been pruned'); } - public function data_set_endpoint_padding(): array + public static function data_set_endpoint_padding(): array { return [ [ diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 08505667d7..f0efb9fd22 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -19,7 +19,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_posting.php'; abstract class phpbb_notification_submit_post_base extends phpbb_database_test_case { - protected $notifications, $db, $container, $user, $config, $auth, $cache; +// protected $notifications, $db, $container, $user, $config, $auth, $cache; protected $item_type = ''; @@ -52,9 +52,9 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c protected function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader; + parent::setUp(); // Database $this->db = $this->new_dbal(); @@ -103,15 +103,15 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $storage = $this->createMock('\phpbb\storage\storage'); // User - $user = $this->createMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->ip = ''; - $user->data = array( - 'user_id' => 2, - 'username' => 'user-name', - 'is_registered' => true, - 'user_colour' => '', - 'user_lastmark' => 0, - ); + $user->data['user_id'] = 2; + $user->data['username'] = 'user-name'; + $user->data['is_registered'] = true; + $user->data['user_colour'] = ''; + $user->data['user_lastmark'] = 0; // Request $request = new phpbb_mock_request(); @@ -122,6 +122,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($avatar_helper, $db, $phpbb_root_path, $phpEx, USERS_TABLE); + $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); // Container $phpbb_container = new ContainerBuilder(); @@ -190,6 +191,14 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c */ public function test_submit_post($additional_post_data, $expected_before, $expected_after) { + global $db, $auth, $user, $config, $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + if (isset($additional_post_data['message'])) + { + $parser = $this->get_test_case_helpers()->set_s9e_services($phpbb_container)->get('text_formatter.parser'); + $additional_post_data['message'] = $parser->parse($additional_post_data['message']); + } + $sql = 'SELECT user_id, item_id, item_parent_id FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php index d3161b5ccd..1726d09e9b 100644 --- a/tests/notification/submit_post_type_bookmark_test.php +++ b/tests/notification/submit_post_type_bookmark_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -49,7 +51,7 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati * submit_post() $mode = 'reply' * Notification item_type = 'bookmark' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_forum_test.php b/tests/notification/submit_post_type_forum_test.php index 7f06b18951..e6c20fd9dd 100644 --- a/tests/notification/submit_post_type_forum_test.php +++ b/tests/notification/submit_post_type_forum_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_forum_test extends phpbb_notification_ public function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -59,7 +61,7 @@ class phpbb_notification_submit_post_type_forum_test extends phpbb_notification_ * submit_post() $mode = 'reply' * Notification item_type = 'notification.type.forum' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_mention_test.php b/tests/notification/submit_post_type_mention_test.php index f660a38ecc..80204b8351 100644 --- a/tests/notification/submit_post_type_mention_test.php +++ b/tests/notification/submit_post_type_mention_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_mention_test extends phpbb_notification_submit_post_base { @@ -19,9 +19,9 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio public function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth; + parent::setUp(); // Add additional permissions $auth->expects($this->any()) @@ -53,11 +53,8 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio * submit_post() $mode = 'reply' * Notification item_type = 'mention' */ - public function submit_post_data() + public static function submit_post_data() { - // The new mock container is needed because the data providers may be executed before phpunit call setUp() - $parser = $this->get_test_case_helpers()->set_s9e_services(new phpbb_mock_container_builder())->get('text_formatter.parser'); - return array( /** * Normal post @@ -73,7 +70,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[mention=u:2]poster[/mention] poster should not be notified', '[mention=u:3]test[/mention] test should be notified', '[mention=u:4]unauthorized[/mention] unauthorized to read, should not receive a notification', @@ -83,7 +80,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio '[mention=g:1]normal group[/mention] group members of a normal group shoud receive a notification', '[mention=g:2]hidden group[/mention] group members of a hidden group shoud not receive a notification from a non-member', '[mention=u:10]doesn\'t exist[/mention] user does not exist, should not receive a notification', - ))), + )), 'bbcode_uid' => 'uid', ), array( @@ -105,7 +102,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[mention=u:2]poster[/mention] poster should not be notified', '[mention=u:3]test[/mention] test should be notified', '[mention=u:4]unauthorized[/mention] unauthorized to read, should not receive a notification', @@ -113,7 +110,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio '[mention=u:6]disabled[/mention] option disabled, should not receive a notification', '[mention=u:7]default[/mention] option set to default, should receive a notification', '[mention=u:8]doesn\'t exist[/mention] user does not exist, should not receive a notification', - ))), + )), 'bbcode_uid' => 'uid', 'force_approved_state' => false, ), diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php index 3ef4395c0f..002bb60f2b 100644 --- a/tests/notification/submit_post_type_post_in_queue_test.php +++ b/tests/notification/submit_post_type_post_in_queue_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notif protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -62,7 +64,7 @@ class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notif * submit_post() $mode = 'reply' * Notification item_type = 'post_in_queue' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php index d63822bad0..cb6008f500 100644 --- a/tests/notification/submit_post_type_post_test.php +++ b/tests/notification/submit_post_type_post_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -59,7 +61,7 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s * submit_post() $mode = 'reply' * Notification item_type = 'post' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php index fd73a264fa..92222f9e41 100644 --- a/tests/notification/submit_post_type_quote_test.php +++ b/tests/notification/submit_post_type_quote_test.php @@ -19,6 +19,8 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ protected function setUp(): void { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + parent::setUp(); global $auth; @@ -49,11 +51,8 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ * submit_post() $mode = 'reply' * Notification item_type = 'quote' */ - public function submit_post_data() + public static function submit_post_data() { - // The new mock container is needed because the data providers may be executed before phpunit call setUp() - $parser = $this->get_test_case_helpers()->set_s9e_services(new phpbb_mock_container_builder())->get('text_formatter.parser'); - return array( /** * Normal post @@ -68,7 +67,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[quote="poster"]poster should not be notified[/quote]', '[quote="test"]test should be notified[/quote]', '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', @@ -76,7 +75,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ '[quote="disabled"]option disabled, should not receive a notification[/quote]', '[quote="default"]option set to default, should receive a notification[/quote]', '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', - ))), + )), 'bbcode_uid' => 'uid', ), array( @@ -97,7 +96,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ array( array( - 'message' => $parser->parse(implode(' ', array( + 'message' => implode(' ', array( '[quote="poster"]poster should not be notified[/quote]', '[quote="test"]test should be notified[/quote]', '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', @@ -105,7 +104,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ '[quote="disabled"]option disabled, should not receive a notification[/quote]', '[quote="default"]option set to default, should receive a notification[/quote]', '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', - ))), + )), 'bbcode_uid' => 'uid', 'force_approved_state' => false, ), diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php index b4297dee6b..28403ec0ed 100644 --- a/tests/notification/submit_post_type_topic_test.php +++ b/tests/notification/submit_post_type_topic_test.php @@ -19,9 +19,9 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ protected function setUp(): void { - parent::setUp(); + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; - global $auth, $phpbb_log; + parent::setUp(); // Add additional permissions $auth->expects($this->any()) @@ -41,8 +41,6 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ ), ), ))); - - $phpbb_log = $this->createMock('\phpbb\log\dummy'); } /** @@ -51,7 +49,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ * submit_post() $mode = 'post' * Notification item_type = 'topic' */ - public function submit_post_data() + public static function submit_post_data() { return array( /** @@ -97,6 +95,8 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ */ public function test_submit_post($additional_post_data, $expected_before, $expected_after) { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader, $phpbb_log; + $sql = 'SELECT user_id, item_id, item_parent_id FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index 6ae225b667..f895b89589 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -70,7 +70,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case ); } - public function user_list_trim_data() + public static function user_list_trim_data() { return array( array( diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 0a665c1cfb..40b228f6bc 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -82,7 +82,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher); } - public function generate_template_pagination_data() + public static function generate_template_pagination_data() { return array( array( @@ -229,7 +229,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); } - public function on_page_data() + public static function on_page_data() { return array( array( @@ -255,7 +255,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect_return, $this->pagination->on_page($num_items, $per_page, $start_item)); } - public function validate_start_data() + public static function validate_start_data() { return array( array( @@ -304,7 +304,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect, $this->pagination->validate_start($start, 10, $num_items)); } - public function reverse_start_data() + public static function reverse_start_data() { return array( array( @@ -330,7 +330,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals($expect, $this->pagination->reverse_start($start, $limit, $num_items)); } - public function reverse_limit_data() + public static function reverse_limit_data() { return array( array( diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php index a84dc0d079..d32f9bf9a8 100644 --- a/tests/passwords/drivers_test.php +++ b/tests/passwords/drivers_test.php @@ -16,6 +16,14 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case /** @var array */ protected $passwords_drivers = []; + // Initialize argon2 default options + public static $argon2_default_cost_options = + [ + 'memory_cost' => 65536, + 'time_cost' => 4, + 'threads' => 2 + ]; + protected function setUp(): void { // Prepare dependencies for drivers @@ -25,13 +33,6 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $php_ext = 'php'; - // Initialize argon2 default options - $this->argon2_default_cost_options = [ - 'memory_cost' => 65536, - 'time_cost' => 4, - 'threads' => 2 - ]; - $this->passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper, 10), 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper, 10), @@ -52,17 +53,17 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case if (defined('PASSWORD_ARGON2I') && $pwhash_supported) { $this->passwords_drivers['passwords.driver.argon2i'] = new \phpbb\passwords\driver\argon2i($config, $this->driver_helper); - $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2i']->get_options(); + self::$argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2i']->get_options(); } if (defined('PASSWORD_ARGON2ID') && $pwhash_supported) { $this->passwords_drivers['passwords.driver.argon2id'] = new \phpbb\passwords\driver\argon2id($config, $this->driver_helper); - $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2id']->get_options(); + self::$argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2id']->get_options(); } } - public function data_helper_encode64() + public static function data_helper_encode64() { return array( array('foobars', 6, 'axqPW3aQ'), @@ -80,7 +81,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame($output, $return); } - public function data_get_random_salt() + public static function data_get_random_salt() { return array( array(24, false), @@ -118,7 +119,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertEquals(false, $this->passwords_drivers['passwords.driver.salted_md5']->get_hash_settings(false)); } - public function data_hash_sha1_smf() + public static function data_hash_sha1_smf() { return array( array(false, 'test', array()), @@ -135,7 +136,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha1_smf']->hash($password, $user_row)); } - public function data_get_settings() + public static function data_get_settings() { return array( array(false, '6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'passwords.driver.sha1_smf'), @@ -150,7 +151,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame($expected, $this->passwords_drivers[$driver]->get_settings_only($hash)); } - public function data_md5_phpbb2_check() + public static function data_md5_phpbb2_check() { return array( array(false, 'foobar', 'ae2fc75e20ee25d4520766788fbc96ae'), @@ -158,8 +159,8 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case array(false, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae'), array(true, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae', utf8_decode('fööbar')), array(true, 'fööbar', '$H$966CepJh9RC3hFIm7aKywR6jEn0kpA0', utf8_decode('fööbar')), - array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252(utf8_decode('fööbar'))), - array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252('fööbar')), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', self::utf8_to_cp1252(utf8_decode('fööbar'))), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', self::utf8_to_cp1252('fööbar')), ); } @@ -194,7 +195,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1']->hash('foobar')); } - public function data_md5_mybb_check() + public static function data_md5_mybb_check() { return array( array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), @@ -216,7 +217,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->hash('foobar')); } - public function data_md5_vb_check() + public static function data_md5_vb_check() { return array( array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), @@ -240,7 +241,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_vb']->hash('foobar')); } - public function data_sha1_wcf1_check() + public static function data_sha1_wcf1_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -262,7 +263,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1_wcf1']->hash('foobar')); } - public function data_bcrypt_wcf2_check() + public static function data_bcrypt_wcf2_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -284,7 +285,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.bcrypt_wcf2']->hash('foobar')); } - public function data_sha_xf1_check() + public static function data_sha_xf1_check() { return array( array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), @@ -307,7 +308,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha_xf1']->hash('foobar')); } - protected function utf8_to_cp1252($string) + protected static function utf8_to_cp1252($string) { static $transform = array( "\xE2\x82\xAC" => "\x80", @@ -437,36 +438,24 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case return strtr($string, $transform); } - public function data_needs_rehash() + public static function data_needs_rehash() { - $data_array = [ + return [ array('passwords.driver.bcrypt_2y', '$2y$10$somerandomhash', false), array('passwords.driver.bcrypt', '$2a$10$somerandomhash', false), array('passwords.driver.salted_md5', 'foobar', false), array('passwords.driver.bcrypt_2y', '$2y$9$somerandomhash', true), array('passwords.driver.bcrypt', '$2a$04$somerandomhash', true), + + array('passwords.driver.argon2i', '$argon2i$v=19$m=' . self::$argon2_default_cost_options['memory_cost'] . ',t=' . self::$argon2_default_cost_options['time_cost'] . ',p=' . self::$argon2_default_cost_options['threads'] . '$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false), + array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true), + array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true), + array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true), + + array('passwords.driver.argon2id', '$argon2id$v=19$m=' . self::$argon2_default_cost_options['memory_cost'] . ',t=' . self::$argon2_default_cost_options['time_cost'] . ',p=' . self::$argon2_default_cost_options['threads'] . '$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false), + array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true), + array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true), ]; - - if (isset($this->passwords_drivers['passwords.driver.argon2i'])) - { - $data_array = array_merge($data_array, [ - array('passwords.driver.argon2i', '$argon2i$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false), - array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true), - array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true), - array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true), - ]); - } - - if (isset($this->passwords_drivers['passwords.driver.argon2id'])) - { - $data_array = array_merge($data_array, [ - array('passwords.driver.argon2id', '$argon2id$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false), - array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true), - array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true), - ]); - } - - return $data_array; } /** @@ -474,7 +463,7 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case */ public function test_needs_rehash($driver, $hash, $expected) { - if (!$this->passwords_drivers[$driver]->is_supported()) + if (!isset($this->passwords_drivers[$driver]) || !$this->passwords_drivers[$driver]->is_supported()) { $this->markTestSkipped($driver . ' is not supported'); } diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 7b1b9a1cc3..273683a097 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -58,7 +58,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->manager = new \phpbb\passwords\manager($config, $this->passwords_drivers, $this->helper, array_keys($this->passwords_drivers)); } - public function hash_password_data() + public static function hash_password_data() { return array( array('', '2y', 60), @@ -94,7 +94,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case } } - public function check_password_data() + public static function check_password_data() { return array( array('passwords.driver.bcrypt_2y'), @@ -126,7 +126,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case } - public function check_hash_exceptions_data() + public static function check_hash_exceptions_data() { return array( array('3858f62230ac3c915f300c664312c63f', true), @@ -164,7 +164,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertEquals($expected, $this->manager->check($password, $hash, $user_row)); } - public function data_hash_password_length() + public static function data_hash_password_length() { return array( array('passwords.driver.bcrypt', false), @@ -188,7 +188,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertNotEquals(false, $this->manager->hash('foobar𝄞', 'passwords.driver.bcrypt_2y')); } - public function combined_hash_data() + public static function combined_hash_data() { return array( array( @@ -276,7 +276,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertLessThanOrEqual(5, time() - $start_time); } - public function data_test_string_compare() + public static function data_test_string_compare() { return array( array('foo', 'bar', false), @@ -294,7 +294,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case $this->assertSame($expected, $this->driver_helper->string_compare($a, $b)); } - public function data_driver_interface_driver() + public static function data_driver_interface_driver() { return array( array(false, false, false), diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index dc89e1ca92..09693c1ceb 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -17,20 +17,20 @@ class phpbb_path_helper_test extends phpbb_test_case { /** @var \phpbb\path_helper */ protected $path_helper; - protected $phpbb_root_path = ''; + protected static $phpbb_root_path = ''; protected function setUp(): void { parent::setUp(); - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); $this->path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); @@ -44,17 +44,17 @@ class phpbb_path_helper_test extends phpbb_test_case * any time we wish to use it in one of these functions (and * also in general for everything else) */ - public function set_phpbb_root_path() + public static function set_phpbb_root_path() { - $this->phpbb_root_path = filesystem_helper::clean_path(__DIR__ . '/../../phpBB/'); + self::$phpbb_root_path = filesystem_helper::clean_path(__DIR__ . '/../../phpBB/'); } public function test_get_web_root_path() { - $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path, $this->path_helper->get_web_root_path()); // Second call will use class property - $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path, $this->path_helper->get_web_root_path()); } public function test_get_adm_relative_path() @@ -67,9 +67,9 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertSame('php', $this->path_helper->get_php_ext()); } - public function basic_update_web_root_path_data() + public static function basic_update_web_root_path_data() { - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); return [ [ @@ -78,16 +78,16 @@ class phpbb_path_helper_test extends phpbb_test_case '/', ], [ - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', ], [ 'test.php', 'test.php', ], [ - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - filesystem_helper::clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), + self::$phpbb_root_path . self::$phpbb_root_path . 'test.php', + filesystem_helper::clean_path(self::$phpbb_root_path . self::$phpbb_root_path . 'test.php'), ], ]; } @@ -108,7 +108,7 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ]) @@ -116,44 +116,44 @@ class phpbb_path_helper_test extends phpbb_test_case ->getMock(); $path_helper->method('get_web_root_path') ->willReturn('/var/www/phpbb/app.php/'); - $this->assertEquals('/var/www/phpbb/app.php/foo', $path_helper->update_web_root_path($this->phpbb_root_path . 'app.php/foo')); + $this->assertEquals('/var/www/phpbb/app.php/foo', $path_helper->update_web_root_path(self::$phpbb_root_path . 'app.php/foo')); } - public function update_web_root_path_data() + public static function update_web_root_path_data() { - $this->set_phpbb_root_path(); + self::set_phpbb_root_path(); return array( array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/', '', '', '', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '//', 'foo/bar.php', 'bar.php', './../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/app.php/foo/template', '/phpbb-fork/phpBB/app.php', './../../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/foo/template', '/phpbb-fork/phpBB/app.php', './../', ), array( - $this->phpbb_root_path . 'test.php', + self::$phpbb_root_path . 'test.php', '/', '/phpbb-fork/phpBB/app.php/', '/phpbb-fork/phpBB/app.php', @@ -162,35 +162,35 @@ class phpbb_path_helper_test extends phpbb_test_case // No correction if the path is already prepend by the web root path array( - './../' . $this->phpbb_root_path . 'test.php', + './../' . self::$phpbb_root_path . 'test.php', '//', 'foo/bar.php', 'bar.php', '', ), array( - './../../' . $this->phpbb_root_path . 'test.php', + './../../' . self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/app.php/foo/template', '/phpbb-fork/phpBB/app.php', '', ), array( - './../' . $this->phpbb_root_path . 'test.php', + './../' . self::$phpbb_root_path . 'test.php', '/foo/template', '/phpbb-fork/phpBB/foo/template', '/phpbb-fork/phpBB/app.php', '', ), array( - './../'.$this->phpbb_root_path . 'test.php', + './../'.self::$phpbb_root_path . 'test.php', '/', '/phpbb-fork/phpBB/app.php/', '/phpbb-fork/phpBB/app.php', '', ), array( - './../'.$this->phpbb_root_path . 'test.php', + './../'.self::$phpbb_root_path . 'test.php', '', '/phpbb-fork/phpBB/foo', '/phpbb-fork/phpBB/app.php', @@ -218,17 +218,16 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php' ); $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input)); } - public function remove_web_root_path_data() + public static function remove_web_root_path_data() { - $filesystem = new \phpbb\filesystem\filesystem(); - $this->set_phpbb_root_path($filesystem); + self::set_phpbb_root_path(); return [ [ @@ -237,7 +236,7 @@ class phpbb_path_helper_test extends phpbb_test_case ], [ '/var/www/phpbb/test.php', - $this->phpbb_root_path . 'test.php' + self::$phpbb_root_path . 'test.php' ] ]; } @@ -253,7 +252,7 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ]) @@ -265,7 +264,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $path_helper->remove_web_root_path($input)); } - public function clean_url_data() + public static function clean_url_data() { return array( array('', ''), @@ -288,7 +287,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->clean_url($input)); } - public function glue_url_params_data() + public static function glue_url_params_data() { return array( array( @@ -326,7 +325,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->glue_url_params($params)); } - public function get_url_parts_data() + public static function get_url_parts_data() { return array( array( @@ -390,7 +389,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->get_url_parts($url, $is_amp)); } - public function strip_url_params_data() + public static function strip_url_params_data() { return array( array( @@ -428,7 +427,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->strip_url_params($url, $strip, $is_amp)); } - public function append_url_params_data() + public static function append_url_params_data() { return array( array( @@ -484,12 +483,12 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $request, - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); - $this->assertEquals($this->phpbb_root_path . '../../', $path_helper->get_web_root_path()); + $this->assertEquals(self::$phpbb_root_path . '../../', $path_helper->get_web_root_path()); } /** @@ -500,7 +499,7 @@ class phpbb_path_helper_test extends phpbb_test_case $this->assertEquals($expected, $this->path_helper->append_url_params($url, $params, $is_amp)); } - public function get_web_root_path_from_ajax_referer_data() + public static function get_web_root_path_from_ajax_referer_data() { return [ [ @@ -581,10 +580,10 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_get_web_root_path_from_ajax_referer($referer_url, $board_url, $expected) { - $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); + $this->assertEquals(self::$phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); } - public function data_get_valid_page() + public static function data_get_valid_page() { return array( // array( current page , mod_rewrite setting , expected output ) @@ -606,10 +605,10 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_get_valid_page($page, $mod_rewrite, $expected) { - $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite)); + $this->assertEquals(self::$phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite)); } - public function is_router_used_data() + public static function is_router_used_data() { return [ [ @@ -638,7 +637,7 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, $this->createMock('\phpbb\request\request'), - $this->phpbb_root_path, + self::$phpbb_root_path, 'php', 'adm/' ); diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php index 6080220c32..4d020bbdbf 100644 --- a/tests/plupload/plupload_test.php +++ b/tests/plupload/plupload_test.php @@ -13,7 +13,7 @@ class phpbb_plupload_test extends phpbb_test_case { - public function generate_resize_string_data() + public static function generate_resize_string_data() { return array( array( @@ -61,7 +61,7 @@ class phpbb_plupload_test extends phpbb_test_case $this->assertEquals($expected, $plupload->generate_resize_string()); } - public function data_get_chunk_size() + public static function data_get_chunk_size() { return [ [[ diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php index 6736fc6732..49bc45805a 100644 --- a/tests/profilefields/type_bool_test.php +++ b/tests/profilefields/type_bool_test.php @@ -77,7 +77,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -101,7 +101,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -137,7 +137,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index 480b03baf0..b7ccda3579 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -60,7 +60,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -96,7 +96,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -180,7 +180,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php index e19364a459..17e1a7b3f9 100644 --- a/tests/profilefields/type_dropdown_test.php +++ b/tests/profilefields/type_dropdown_test.php @@ -78,7 +78,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -132,7 +132,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -175,7 +175,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index a4161ce412..1fb512e1a6 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -51,7 +51,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -118,7 +118,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -172,7 +172,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index a813cc248b..351495069d 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -56,7 +56,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -243,7 +243,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_data() + public static function profile_value_data() { return array( array( @@ -298,7 +298,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index 7a604ebbd4..177b3efbb1 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -59,7 +59,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ); } - public function validate_profile_field_data() + public static function validate_profile_field_data() { return array( array( @@ -152,7 +152,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } - public function profile_value_raw_data() + public static function profile_value_raw_data() { return array( array( @@ -184,7 +184,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ); } - public function profile_value_data() + public static function profile_value_data() { return array( array( diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php index 6da6083e19..8b1410ac7f 100644 --- a/tests/regex/censor_test.php +++ b/tests/regex/censor_test.php @@ -13,7 +13,7 @@ class phpbb_regex_censor_test extends phpbb_test_case { - public function censor_test_data() + public static function censor_test_data() { return array( array('bad*word', 'bad word'), diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php index b281941c49..ccb98558dc 100644 --- a/tests/regex/email_test.php +++ b/tests/regex/email_test.php @@ -20,7 +20,7 @@ class phpbb_regex_email_test extends phpbb_test_case $this->regex = '#^' . get_preg_expression('email') . '$#i'; } - public function positive_match_data() + public static function positive_match_data() { return array( array('nobody@phpbb.com'), @@ -60,7 +60,7 @@ class phpbb_regex_email_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( array('foo.example.com'), // @ is missing diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php index 1bd8948b87..954f24bbcd 100644 --- a/tests/regex/ipv4_test.php +++ b/tests/regex/ipv4_test.php @@ -20,7 +20,7 @@ class phpbb_regex_ipv4_test extends phpbb_test_case $this->regex = get_preg_expression('ipv4'); } - public function positive_match_data() + public static function positive_match_data() { return array( array('0.0.0.0'), @@ -30,7 +30,7 @@ class phpbb_regex_ipv4_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // IPv6 addresses diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php index 92e74a0220..720161ee8c 100644 --- a/tests/regex/ipv6_test.php +++ b/tests/regex/ipv6_test.php @@ -20,7 +20,7 @@ class phpbb_regex_ipv6_test extends phpbb_test_case $this->regex = get_preg_expression('ipv6'); } - public function positive_match_data() + public static function positive_match_data() { return array( // Full length IPv6 address @@ -97,7 +97,7 @@ class phpbb_regex_ipv6_test extends phpbb_test_case ); } - public function negative_match_data() + public static function negative_match_data() { return array( // Empty address diff --git a/tests/regex/password_complexity_test.php b/tests/regex/password_complexity_test.php index 37f3a0c53a..2ee325e40d 100644 --- a/tests/regex/password_complexity_test.php +++ b/tests/regex/password_complexity_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions_user.php'; class phpbb_password_complexity_test extends phpbb_test_case { - public function password_complexity_test_data_positive() + public static function password_complexity_test_data_positive() { return array( array('12345', 'PASS_TYPE_ANY'), @@ -33,7 +33,7 @@ class phpbb_password_complexity_test extends phpbb_test_case ); } - public function password_complexity_test_data_negative() + public static function password_complexity_test_data_negative() { return array( array('qwerty', 'PASS_TYPE_CASE'), diff --git a/tests/regex/table_prefix_test.php b/tests/regex/table_prefix_test.php index f425041c94..0fad1d0e1c 100644 --- a/tests/regex/table_prefix_test.php +++ b/tests/regex/table_prefix_test.php @@ -13,7 +13,7 @@ class phpbb_regex_table_prefix_test extends phpbb_test_case { - public function table_prefix_test_data() + public static function table_prefix_test_data() { return array( array('phpbb_', 1), diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php index 5e2a22bf73..5e39a7ba36 100644 --- a/tests/regex/url_test.php +++ b/tests/regex/url_test.php @@ -13,7 +13,7 @@ class phpbb_regex_url_test extends phpbb_test_case { - public function url_test_data() + public static function url_test_data() { return array( array('http://www.phpbb.com/community/', 1), diff --git a/tests/request/request_test.php b/tests/request/request_test.php index d03253ceb9..3744d9b38e 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -146,7 +146,7 @@ class phpbb_request_test extends phpbb_test_case $this->assertTrue($this->request->is_ajax()); } - public function data_is_secure() + public static function data_is_secure() { return array( array( diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index ea1a1ac89e..253b7abb73 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -108,7 +108,7 @@ class phpbb_request_var_test extends phpbb_test_case $this->assertEquals($expected, $result); } - public function deep_access() + public static function deep_access() { return array( // array(path, default, expected result) @@ -119,7 +119,7 @@ class phpbb_request_var_test extends phpbb_test_case ); } - public function request_variables() + public static function request_variables() { return array( // strings diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php index 745008ec3a..87989646eb 100644 --- a/tests/request/type_cast_helper_test.php +++ b/tests/request/type_cast_helper_test.php @@ -20,7 +20,7 @@ class phpbb_type_cast_helper_test extends phpbb_test_case $this->type_cast_helper = new \phpbb\request\type_cast_helper(); } - public function type_cast_helper_test_data() + public static function type_cast_helper_test_data() { return [ [ diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php index fc4b461452..f797d414f9 100644 --- a/tests/search/common_test_case.php +++ b/tests/search/common_test_case.php @@ -17,7 +17,7 @@ abstract class phpbb_search_common_test_case extends phpbb_search_test_case { protected $search; - public function keywords() + public static function keywords() { return array( // keywords diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php index fe7326bb3e..981d04d11c 100644 --- a/tests/search/mysql_test.php +++ b/tests/search/mysql_test.php @@ -34,8 +34,10 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case $user = $this->createMock('\phpbb\user'); // set config values - $config['fulltext_mysql_min_word_len'] = 4; - $config['fulltext_mysql_max_word_len'] = 254; + $config = new \phpbb\config\config([ + 'fulltext_mysql_min_word_len' => 4, + 'fulltext_mysql_max_word_len' => 254, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 0d8d8e6810..92a0d52dc4 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -43,13 +43,15 @@ class phpbb_search_native_test extends phpbb_search_test_case $this->db_tools = $tools_factory->get($this->new_doctrine_dbal()); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native'); - $config['fulltext_native_min_chars'] = 2; - $config['fulltext_native_max_chars'] = 14; - $config['max_num_search_keywords'] = 10; + $config = new \phpbb\config\config([ + 'fulltext_native_min_chars' => 2, + 'fulltext_native_max_chars' => 14, + 'max_num_search_keywords' => 10, + ]); $this->search = new $class($config, $this->db, $this->db_tools, $phpbb_dispatcher, $language, $user, SEARCH_RESULTS_TABLE, SEARCH_WORDLIST_TABLE, SEARCH_WORDMATCH_TABLE, $phpbb_root_path, $phpEx); } - public function keywords() + public static function keywords() { return array( // keywords @@ -268,7 +270,7 @@ class phpbb_search_native_test extends phpbb_search_test_case $this->assert_array_content_equals($common, $this->search->get_common_words()); } - public function data_split_keywords_max(): array + public static function data_split_keywords_max(): array { return [ 'character count within limits separated by more spaces' => [ diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php index 18c5a46f81..3a699eda2c 100644 --- a/tests/search/postgres_test.php +++ b/tests/search/postgres_test.php @@ -34,8 +34,10 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case $user = $this->createMock('\phpbb\user'); // set config values - $config['fulltext_postgres_min_word_len'] = 4; - $config['fulltext_postgres_max_word_len'] = 254; + $config = new \phpbb\config\config([ + 'fulltext_postgres_min_word_len' => 4, + 'fulltext_postgres_max_word_len' => 254, + ]); $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index 0446673c60..f308468ce3 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/base.php'; class phpbb_security_extract_current_page_test extends phpbb_security_test_base { - public function security_variables() + public static function security_variables() { return array( array('mark=forums&x=">', 'mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E'), diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 74c5c2e03e..8568832600 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -18,7 +18,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base { protected $path_helper; - public function provider() + public static function provider() { // array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false)) return array( diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 4e5a238644..4bd5dbdbdd 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -14,7 +14,7 @@ class phpbb_session_append_sid_test extends phpbb_test_case { - public function append_sid_data() + public static function append_sid_data() { return array( array('viewtopic.php?t=1&f=2', false, true, false, 'viewtopic.php?t=1&f=2', 'parameters in url-argument'), diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php index 0588312c0d..87000a0872 100644 --- a/tests/template/asset_test.php +++ b/tests/template/asset_test.php @@ -15,7 +15,7 @@ use phpbb\template\asset; class phpbb_template_asset_test extends phpbb_test_case { - public function set_path_data() + public static function set_path_data() { return array( // array(phpbb_root_path, given path, expected path), diff --git a/tests/template/context_test.php b/tests/template/context_test.php index a1be672f51..0f88b66a45 100644 --- a/tests/template/context_test.php +++ b/tests/template/context_test.php @@ -43,7 +43,7 @@ class context_test extends phpbb_test_case } } - public function retrieve_block_vars_data() + public static function retrieve_block_vars_data() { return array( array('foo', array(), array()), // non-existent top-level block diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php index e71c8f9ef8..323c605fb9 100644 --- a/tests/template/extension_test.php +++ b/tests/template/extension_test.php @@ -142,7 +142,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case ]); } - public function data_template_extensions() + public static function data_template_extensions() { return [ [ @@ -333,7 +333,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case $this->run_template($file, $vars, $block_vars, $destroy_array, $expected, $lang_vars); } - public function data_template_icon_extension() + public static function data_template_icon_extension() { return [ /** Font: default */ diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index a9b1d39451..a485c0b552 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/template_test_case.php'; class phpbb_template_template_events_test extends phpbb_template_template_test_case { - public function template_data() + public static function template_data() { return array( /* diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index f31bcace3c..209d8c5c38 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -85,7 +85,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } - public function template_data() + public static function template_data() { return array( /* diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 9886ced6ad..6345818712 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -15,10 +15,8 @@ require_once __DIR__ . '/template_test_case_with_tree.php'; class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree { - public function template_data() + public static function template_data() { - $this->setup_engine(); - return array( /* array( diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index 51cc155c9e..5a536a72e6 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -18,7 +18,7 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t /** * @todo put test data into templates/xyz.test */ - public function template_data() + public static function template_data() { return array( // First element of the array is test name - keep them distinct diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 4fc9858366..bb4fa6ad6a 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -18,7 +18,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @todo put test data into templates/xyz.test */ - public function template_data() + public static function template_data() { return array( /* @@ -637,7 +637,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->assertEquals(array('POSITION' => 'O3M2', 'ONE' => true, 'TWO' => 'two', 'THREE' => 3), $this->template->retrieve_block_vars('outer[2].middle[1]', array()), 'Retrieve all vars from a block in the template'); } - public function alter_block_array_data() + public static function alter_block_array_data() { return array( array( @@ -1030,7 +1030,7 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Inserting another inner block in the same place'); } - public function assign_block_vars_array_data() + public static function assign_block_vars_array_data() { return array( array( diff --git a/tests/template/twig_test.php b/tests/template/twig_test.php index 69280caa15..f655cd8702 100644 --- a/tests/template/twig_test.php +++ b/tests/template/twig_test.php @@ -100,7 +100,7 @@ class twig_test extends \phpbb_test_case $run_set_user_closure($this->user); } - public function data_get_user_style(): array + public static function data_get_user_style(): array { return [ [['style_path' => 'prosilver', 'style_parent_id' => 0], ['prosilver']], diff --git a/tests/text_formatter/s9e/acp_utils_test.php b/tests/text_formatter/s9e/acp_utils_test.php index 9d84924042..597dde0f90 100644 --- a/tests/text_formatter/s9e/acp_utils_test.php +++ b/tests/text_formatter/s9e/acp_utils_test.php @@ -26,7 +26,7 @@ class phpbb_textformatter_s9e_acp_utils_test extends phpbb_test_case $this->assertEquals($expected, $actual); } - public function get_analyse_bbcode_tests() + public static function get_analyse_bbcode_tests() { return [ [ diff --git a/tests/text_formatter/s9e/bbcode_merger_test.php b/tests/text_formatter/s9e/bbcode_merger_test.php index 5ec0c91971..55f9bd6f13 100644 --- a/tests/text_formatter/s9e/bbcode_merger_test.php +++ b/tests/text_formatter/s9e/bbcode_merger_test.php @@ -34,7 +34,7 @@ class phpbb_textformatter_s9e_bbcode_merger_test extends phpbb_test_case $this->assertSame($expected_template, $merged['template']); } - public function get_merge_bbcodes_tests() + public static function get_merge_bbcodes_tests() { return [ [ diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index 1b91aa7c83..76b22a7845 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -45,7 +45,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($parsed_text)); } - public function get_default_formatting_tests() + public static function get_default_formatting_tests() { return array( array( diff --git a/tests/text_formatter/s9e/mention_helper_test.php b/tests/text_formatter/s9e/mention_helper_test.php index 26fc743841..356dbb5916 100644 --- a/tests/text_formatter/s9e/mention_helper_test.php +++ b/tests/text_formatter/s9e/mention_helper_test.php @@ -76,7 +76,7 @@ class mention_helper_test extends phpbb_database_test_case $this->mention_helper = $phpbb_container->get('text_formatter.s9e.mention_helper'); } - public function inject_metadata_data() + public static function inject_metadata_data() { return [ [ @@ -99,7 +99,7 @@ class mention_helper_test extends phpbb_database_test_case $this->assertStringContainsString($expected_profile_substring, $result); } - public function get_mentioned_user_ids_data() + public static function get_mentioned_user_ids_data() { return [ [ diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php index ab48f1d20e..61c4f340e2 100644 --- a/tests/text_formatter/s9e/parser_test.php +++ b/tests/text_formatter/s9e/parser_test.php @@ -131,7 +131,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case call_user_func_array(array($parser, $adapter_method), (array) $adapter_arg); } - public function get_options_tests() + public static function get_options_tests() { return array( array( diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index d495bf5191..b39a620931 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -93,7 +93,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($original)); } - public function get_options_cases() + public static function get_options_cases() { return array( array( @@ -141,7 +141,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertSame($expected, $container->get('text_formatter.renderer')->render($original)); } - public function get_default_options_cases() + public static function get_default_options_cases() { return array( array( @@ -278,7 +278,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $this->assertTrue($renderer->{'get_' . $option_name}()); } - public function get_option_names() + public static function get_option_names() { return array( array('viewcensors'), diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php index 2754574c27..ecda57d868 100644 --- a/tests/text_formatter/s9e/utils_test.php +++ b/tests/text_formatter/s9e/utils_test.php @@ -24,7 +24,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->unparse($original)); } - public function get_unparse_tests() + public static function get_unparse_tests() { return array( array( @@ -53,7 +53,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->clean_formatting($original)); } - public function get_clean_formatting_tests() + public static function get_clean_formatting_tests() { return array( array( @@ -87,7 +87,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->get_outermost_quote_authors($parser->parse($original))); } - public function get_outermost_quote_authors_tests() + public static function get_outermost_quote_authors_tests() { return array( array( @@ -124,7 +124,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $utils->generate_quote($text, $params)); } - public function get_generate_quote_tests() + public static function get_generate_quote_tests() { return array( array( @@ -248,7 +248,7 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_remove_bbcode_tests() + public static function get_remove_bbcode_tests() { return array( array( diff --git a/tests/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php index eda2bbb1b3..9398c42e6a 100644 --- a/tests/text_processing/censor_text_test.php +++ b/tests/text_processing/censor_text_test.php @@ -13,7 +13,7 @@ class phpbb_text_processing_censor_text_test extends phpbb_test_case { - public function censor_text_data() + public static function censor_text_data() { global $cache, $user; $cache = new phpbb_mock_cache; diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 0d902c9130..d948dd6148 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -33,7 +33,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -86,7 +86,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case $this->assertSame($expected, $actual); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 7d96152c21..45162ce9c3 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -46,7 +46,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $this->assertSame($expected, $actual); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -132,7 +132,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $this->assertSame($expected, generate_text_for_display($original, '', '', 0, $censor_text)); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_edit_test.php b/tests/text_processing/generate_text_for_edit_test.php index 8258a196f5..a6d08fe364 100644 --- a/tests/text_processing/generate_text_for_edit_test.php +++ b/tests/text_processing/generate_text_for_edit_test.php @@ -31,7 +31,7 @@ class phpbb_text_processing_generate_text_for_edit_test extends phpbb_test_case $this->assertSame($expected, $return['text']); } - public function get_legacy_tests() + public static function get_legacy_tests() { return array( array( @@ -69,7 +69,7 @@ class phpbb_text_processing_generate_text_for_edit_test extends phpbb_test_case $this->assertSame($expected, $return['text']); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/generate_text_for_storage_test.php b/tests/text_processing/generate_text_for_storage_test.php index 86c257a9f6..c2aa7d2db6 100644 --- a/tests/text_processing/generate_text_for_storage_test.php +++ b/tests/text_processing/generate_text_for_storage_test.php @@ -48,7 +48,7 @@ class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_ca $this->assertSame($expected, $actual); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index 3c8539c612..e09d98bfdb 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -13,7 +13,7 @@ class phpbb_text_processing_make_clickable_test extends phpbb_test_case { - public function make_clickable_data() + public static function make_clickable_data() { // value => whether it should work $prefix_texts = array( @@ -101,7 +101,7 @@ class phpbb_text_processing_make_clickable_test extends phpbb_test_case $this->assertEquals($expected, $result, $label); } - public function make_clickable_mixed_serverurl_data() + public static function make_clickable_mixed_serverurl_data() { $urls = array( 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false), diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index 93c0bd6652..e695d05062 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -113,7 +113,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case $this->assertSame($warn_msg, $message_parser->warn_msg); } - public function get_test_polls() + public static function get_test_polls() { return array( array( @@ -183,7 +183,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case $this->assertSame($warn_msg, $message_parser->warn_msg); } - public function get_test_cases() + public static function get_test_cases() { return array( array( diff --git a/tests/text_processing/smilies_test.php b/tests/text_processing/smilies_test.php index 3778e5f58c..180d4c296e 100644 --- a/tests/text_processing/smilies_test.php +++ b/tests/text_processing/smilies_test.php @@ -25,7 +25,7 @@ class phpbb_text_processing_smilies_test extends phpbb_test_case $this->assertSame($expected, $renderer->render($parser->parse($original))); } - public function get_text_formatter_tests() + public static function get_text_formatter_tests() { return array( array( diff --git a/tests/text_processing/strip_bbcode_test.php b/tests/text_processing/strip_bbcode_test.php index 6eae1aa0dd..2fdae3b5f0 100644 --- a/tests/text_processing/strip_bbcode_test.php +++ b/tests/text_processing/strip_bbcode_test.php @@ -14,7 +14,7 @@ class phpbb_text_processing_strip_bbcode_test extends phpbb_test_case { - public function data_strip_bbcode() + public static function data_strip_bbcode() { return [ ['[b:20m4ill1]bold[/b:20m4ill1]', ' bold '], diff --git a/tests/text_processing/tickets_test.php b/tests/text_processing/tickets_test.php index 6230191a69..36eec93b7e 100644 --- a/tests/text_processing/tickets_test.php +++ b/tests/text_processing/tickets_test.php @@ -44,7 +44,7 @@ class phpbb_text_processing_tickets_test extends phpbb_test_case } } - public function get_tickets_data() + public static function get_tickets_data() { $tests = array(); diff --git a/tests/text_reparser/plugins/post_text_test.php b/tests/text_reparser/plugins/post_text_test.php index ecd06ac9bf..8e63ca7256 100644 --- a/tests/text_reparser/plugins/post_text_test.php +++ b/tests/text_reparser/plugins/post_text_test.php @@ -24,7 +24,7 @@ class phpbb_textreparser_post_text_test extends phpbb_textreparser_test_row_base return new \phpbb\textreparser\plugins\post_text($this->db, POSTS_TABLE); } - public function data_reparse_url(): array + public static function data_reparse_url(): array { return [ [ // Reparse the same diff --git a/tests/text_reparser/plugins/test_row_based_plugin.php b/tests/text_reparser/plugins/test_row_based_plugin.php index c03ed39096..60b3e30584 100644 --- a/tests/text_reparser/plugins/test_row_based_plugin.php +++ b/tests/text_reparser/plugins/test_row_based_plugin.php @@ -85,7 +85,7 @@ abstract class phpbb_textreparser_test_row_based_plugin extends phpbb_database_t $this->assertEquals($expected, $this->get_rows($ids)); } - public function get_reparse_tests() + public static function get_reparse_tests() { return array( array( diff --git a/tests/tree/nestedset_forum_add_remove_test.php b/tests/tree/nestedset_forum_add_remove_test.php index e58c1b8c68..863ff8e996 100644 --- a/tests/tree/nestedset_forum_add_remove_test.php +++ b/tests/tree/nestedset_forum_add_remove_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_nestedset_forum_base { - public function delete_data() + public static function delete_data() { return array( array(1, array(1, 2, 3), array( @@ -56,7 +56,7 @@ class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_ $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function delete_throws_data() + public static function delete_throws_data() { return array( array('Not an item', 0), @@ -74,7 +74,7 @@ class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_ $this->set->delete($forum_id); } - public function insert_data() + public static function insert_data() { return array( array(array( diff --git a/tests/tree/nestedset_forum_get_data_test.php b/tests/tree/nestedset_forum_get_data_test.php index 90ef6b3dc3..c887231754 100644 --- a/tests/tree/nestedset_forum_get_data_test.php +++ b/tests/tree/nestedset_forum_get_data_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_nestedset_forum_base { - public function get_path_and_subtree_data_data() + public static function get_path_and_subtree_data_data() { return array( array(1, true, true, array(1, 2, 3)), @@ -43,7 +43,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_and_subtree_data($forum_id, $order_asc, $include_item))); } - public function get_path_data_data() + public static function get_path_data_data() { return array( array(1, true, true, array(1)), @@ -71,7 +71,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_data($forum_id, $order_asc, $include_item))); } - public function get_subtree_data_data() + public static function get_subtree_data_data() { return array( array(1, true, true, array(1, 2, 3)), @@ -99,7 +99,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_subtree_data($forum_id, $order_asc, $include_item))); } - public function get_path_basic_data_data() + public static function get_path_basic_data_data() { return array( array(1, '', array()), @@ -121,7 +121,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $this->assertEquals($expected, array_keys($this->set->get_path_basic_data($forum_data))); } - public function get_all_tree_data_data() + public static function get_all_tree_data_data() { return array( array(true, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)), diff --git a/tests/tree/nestedset_forum_move_test.php b/tests/tree/nestedset_forum_move_test.php index b738a0f6a8..e841daf843 100644 --- a/tests/tree/nestedset_forum_move_test.php +++ b/tests/tree/nestedset_forum_move_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nestedset_forum_base { - public function move_data() + public static function move_data() { return array( array('Move first item up', @@ -132,7 +132,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_down_data() + public static function move_down_data() { return array( array('Move last item down', @@ -179,7 +179,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_up_data() + public static function move_up_data() { return array( array('Move first item up', @@ -226,7 +226,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_children_data() + public static function move_children_data() { return array( array('Item has no children', @@ -376,7 +376,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function move_children_throws_item_data() + public static function move_children_throws_item_data() { return array( array('Item 0 does not exist', 0, 5), @@ -394,7 +394,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->move_children($forum_id, $target_id); } - public function move_children_throws_parent_data() + public static function move_children_throws_parent_data() { return array( array('New parent is child', 4, 5), @@ -413,7 +413,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->move_children($forum_id, $target_id); } - public function change_parent_data() + public static function change_parent_data() { return array( array('Move single child up', @@ -530,7 +530,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function change_parent_throws_item_data() + public static function change_parent_throws_item_data() { return array( array('Item 0 does not exist', 0, 5), @@ -548,7 +548,7 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested $this->set->change_parent($forum_id, $target_id); } - public function change_parent_throws_parent_data() + public static function change_parent_throws_parent_data() { return array( array('New parent is child', 4, 5), diff --git a/tests/tree/nestedset_forum_regenerate_test.php b/tests/tree/nestedset_forum_regenerate_test.php index 487237deda..b5bc806fd3 100644 --- a/tests/tree/nestedset_forum_regenerate_test.php +++ b/tests/tree/nestedset_forum_regenerate_test.php @@ -31,7 +31,7 @@ class phpbb_tests_tree_nestedset_forum_regenerate_test extends phpbb_tests_tree_ array('forum_id' => 11, 'parent_id' => 7, 'left_id' => 20, 'right_id' => 21, 'forum_parents' => ''), ); - public function regenerate_left_right_ids_data() + public static function regenerate_left_right_ids_data() { return array( array('UPDATE phpbb_forums diff --git a/tests/tree/nestedset_forum_test.php b/tests/tree/nestedset_forum_test.php index bffceb73ef..973af35836 100644 --- a/tests/tree/nestedset_forum_test.php +++ b/tests/tree/nestedset_forum_test.php @@ -15,7 +15,7 @@ require_once __DIR__ . '/nestedset_forum_base.php'; class pphpbb_tests_tree_nestedset_forum_test extends phpbb_tests_tree_nestedset_forum_base { - public function forum_constructor_data() + public static function forum_constructor_data() { return array( array(array( @@ -47,7 +47,7 @@ class pphpbb_tests_tree_nestedset_forum_test extends phpbb_tests_tree_nestedset_ $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function get_sql_where_data() + public static function get_sql_where_data() { return array( array('SELECT forum_id diff --git a/tests/ucp/controller_webpush_test.php b/tests/ucp/controller_webpush_test.php index 52356b6f69..2e5fb90ab7 100644 --- a/tests/ucp/controller_webpush_test.php +++ b/tests/ucp/controller_webpush_test.php @@ -91,7 +91,7 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case ); } - public function data_notification_exceptions(): array + public static function data_notification_exceptions(): array { return [ 'not_ajax' => [ diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 887cfdee41..032ab56803 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -124,7 +124,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertTrue($filespec->init_error()); } - public function additional_checks_variables() + public static function additional_checks_variables() { // False here just indicates the file is too large and fails the // filespec::additional_checks method because of it. All other code @@ -165,7 +165,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame(array('WRONG_SIZE'), $filespec->error); } - public function check_content_variables() + public static function check_content_variables() { // False here indicates that a file is non-binary and contains // disallowed content that makes IE report the mimetype incorrectly. @@ -190,7 +190,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals(true, $filespec->check_content(array())); } - public function clean_filename_variables() + public static function clean_filename_variables() { $chunks = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'\\" /:*?<>|[];(){},#+=-_`', 8); return array( @@ -252,7 +252,7 @@ class phpbb_filespec_test extends phpbb_test_case } } - public function data_clean_filename_avatar() + public static function data_clean_filename_avatar() { return array( array(false, false, ''), @@ -285,7 +285,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame($expected, $filespec->get('realname')); } - public function get_extension_variables() + public static function get_extension_variables() { return array( array('file.png', 'png'), @@ -305,7 +305,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, \phpbb\files\filespec::get_extension($filename)); } - public function is_image_variables() + public static function is_image_variables() { return array( array('gif', 'image/gif', true), @@ -328,7 +328,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, $filespec->is_image()); } - public function is_image_get_mimetype() + public static function is_image_get_mimetype() { return array( array('gif', 'image/gif', true), @@ -357,7 +357,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, $filespec->is_image()); } - public function move_file_variables() + public static function move_file_variables() { return array( array('gif_copy', 'gif_moved', 'image/gif', 'gif', false, true), @@ -408,7 +408,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertFalse($filespec->move_file('foo')); } - public function data_move_file_copy() + public static function data_move_file_copy() { return array( array('gif_copy', true, false, array()), @@ -451,7 +451,7 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertSame($expected_error, $filespec->error); } - public function data_move_file_imagesize() + public static function data_move_file_imagesize() { return array( array( diff --git a/tests/upload/imagesize_test.php b/tests/upload/imagesize_test.php index 654e32054a..8ad12740ab 100644 --- a/tests/upload/imagesize_test.php +++ b/tests/upload/imagesize_test.php @@ -27,7 +27,7 @@ class phpbb_upload_imagesize_test extends \phpbb_test_case $this->path = __DIR__ . '/fixture/'; } - public function data_get_imagesize() + public static function data_get_imagesize() { return array( array('foobar', 'image/bmp', false), diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index 4b3c8a5a25..9b1c6fc4cc 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -13,7 +13,7 @@ class phpbb_utf_utf8_clean_string_test extends phpbb_test_case { - public function cleanable_strings() + public static function cleanable_strings() { return array( array('MiXed CaSe', 'mixed case', 'Checking case folding'), diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php index 73ea472df1..abc5475ad3 100644 --- a/tests/version/version_helper_remote_test.php +++ b/tests/version/version_helper_remote_test.php @@ -84,7 +84,7 @@ class version_helper_remote_test extends \phpbb_test_case $this->user->add_lang('acp/common'); } - public function provider_get_versions() + public static function provider_get_versions() { return array( array('', false, '', 'VERSIONCHECK_FAIL'), diff --git a/tests/version/version_helper_test.php b/tests/version/version_helper_test.php index 9a44173314..0683fac555 100644 --- a/tests/version/version_helper_test.php +++ b/tests/version/version_helper_test.php @@ -37,7 +37,7 @@ class phpbb_version_helper_test extends phpbb_test_case ); } - public function is_stable_data() + public static function is_stable_data() { return array( array( @@ -87,7 +87,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $this->version_helper->is_stable($version)); } - public function get_suggested_updates_data() + public static function get_suggested_updates_data() { return array( array( @@ -229,7 +229,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_suggested_updates()); } - public function get_latest_on_current_branch_data() + public static function get_latest_on_current_branch_data() { return array( array( @@ -345,7 +345,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_latest_on_current_branch()); } - public function get_update_on_branch_data() + public static function get_update_on_branch_data() { return array( array( @@ -602,7 +602,7 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_update_on_branch()); } - public function get_ext_update_on_branch_data() + public static function get_ext_update_on_branch_data() { return array( // Single branch, check version for current branch diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php index 5d1eef3f85..0c3f9d993e 100644 --- a/tests/viewonline/helper_test.php +++ b/tests/viewonline/helper_test.php @@ -26,7 +26,7 @@ class phpbb_viewonline_helper_test extends phpbb_test_case $this->viewonline_helper = new \phpbb\viewonline_helper($db); } - public function session_pages_data() + public static function session_pages_data() { return array( array('index.php', 'index'), diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index ee23fe779c..a12d0e50ac 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -97,7 +97,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case ); } - public function equality_test_data() + public static function equality_test_data() { return array( array('1.1.0-A2', '1.1.0-a2'), @@ -118,7 +118,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case } - public function alpha_beta_test_data() + public static function alpha_beta_test_data() { return array( array(-1, '1.1.0-A2', '1.1.0-B1'),