diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 5e588764bd..c96d67d9d7 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -556,6 +556,7 @@ class compress_tar extends compress { var $isgz = false; var $isbz = false; + var $file = ''; var $filename = ''; var $mode = ''; var $type = ''; diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index 0ab19c5bb3..7056bda350 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -70,11 +70,11 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg /** * Redirects isset to the correct request class call. * - * @param string $offset The key of the super global being accessed. + * @param mixed $offset The key of the super global being accessed. * * @return bool Whether the key on the super global exists. */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return $this->request->is_set($offset, $this->super_global); } @@ -82,17 +82,17 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg /**#@+ * Part of the \ArrayAccess implementation, will always result in a FATAL error. */ - public function offsetGet($offset): void + #[\ReturnTypeWillChange] public function offsetGet($offset): void { $this->error(); } - public function offsetSet($offset, $value): void + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->error(); } - public function offsetUnset($offset): void + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { $this->error(); } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index f3f4cd04c4..e90539a8a0 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -27,7 +27,7 @@ class user extends \phpbb\session protected $language; var $style = array(); - var $date_format; + var $date_format = ''; /** * DateTimeZone object holding the timezone of the user @@ -627,12 +627,12 @@ class user extends \phpbb\session * Format user date * * @param int $gmepoch unix timestamp - * @param string|false $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. + * @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. * @param bool $forcedate force non-relative date format. * * @return mixed translated date */ - function format_date($gmepoch, $format = false, $forcedate = false) + function format_date($gmepoch, $format = '', $forcedate = false) { global $phpbb_dispatcher; static $utc; diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 5a3e075b94..1e245f88ae 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -21,9 +21,10 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case { protected $cache_dir; protected $cache; + protected $config; protected $db; protected $db_tools; - protected $config; + protected $language; protected $user; protected function setUp(): void diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index 3a006d27d7..aa5e72bb82 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -23,6 +23,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case protected $db; protected $config; protected $cache; + protected $language; protected $user; protected $storage; protected $temp; diff --git a/tests/console/user/base.php b/tests/console/user/base.php index 511cfff9a3..06e80200b5 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -15,12 +15,14 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case { protected $db; protected $config; + protected $email; protected $user; protected $language; protected $log; protected $passwords_manager; /** @var Symfony\Component\Console\Helper\QuestionHelper */ protected $question; + protected $command_name; protected $user_loader; protected $phpbb_root_path; protected $php_ext; diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 5fbb3fae63..7c76da32d3 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -15,21 +15,59 @@ require_once __DIR__ . '/../mock/lang.php'; class phpbb_datetime_from_format_test extends phpbb_test_case { + /** @var \phpbb\language\language */ + protected $lang; + + /** @var \phpbb\user */ + protected $user; + + protected function setUp(): void + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->lang = new \phpbb\language\language($lang_loader); + + // Set up language data for testing + $reflection_class = new ReflectionClass('\phpbb\language\language'); + // Set default language files loaded flag to true + $common_language_files_loaded_flag = $reflection_class->getProperty('common_language_files_loaded'); + $common_language_files_loaded_flag->setAccessible(true); + $common_language_files_loaded_flag->setValue($this->lang, true); + // Set up test language data + $lang_array = $reflection_class->getProperty('lang'); + $lang_array->setAccessible(true); + $lang_array->setValue($this->lang, [ + 'datetime' => [ + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => [ + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ], + ], + ]); + + $this->user = new \phpbb\user($this->lang, '\phpbb\datetime'); + } + public static function from_format_data() { - return array( - array( + return [ + [ 'UTC', 'Y-m-d', '2012-06-08', - ), + ], - array( + [ 'Europe/Berlin', 'Y-m-d H:i:s', '2012-06-08 14:01:02', - ), - ); + ], + ]; } /** @@ -37,25 +75,9 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_from_format($timezone, $format, $expected) { - global $phpbb_root_path, $phpEx; - - $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->timezone = new DateTimeZone($timezone); - $user->lang['datetime'] = array( - 'TODAY' => 'Today', - 'TOMORROW' => 'Tomorrow', - 'YESTERDAY' => 'Yesterday', - 'AGO' => array( - 0 => 'less than a minute ago', - 1 => '%d minute ago', - 2 => '%d minutes ago', - ), - ); - - $timestamp = $user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); - $this->assertEquals($expected, $user->format_date($timestamp, $format, true)); + $this->user->timezone = new DateTimeZone($timezone); + $timestamp = $this->user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); + $this->assertEquals($expected, $this->user->format_date($timestamp, $format, true)); } public static function relative_format_date_data() @@ -65,58 +87,54 @@ class phpbb_datetime_from_format_test extends phpbb_test_case // So we use 18:01 in the morning and 06:01 in the afternoon. $testing_time = gmdate('H') <= 12 ? '18:01' : '06:01'; - return array( - array( + return [ + [ gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, false, gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, false, 'Tomorrow ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, true, gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d') . ' ' . $testing_time, false, 'Today ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d') . ' ' . $testing_time, true, gmdate('Y-m-d') . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, false, 'Yesterday ' . $testing_time, - ), - array( + ], + [ gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, true, gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, - ), - - array( + ], + [ gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, false, gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, - ), + ], // Test edge cases: Yesterday 00:00, Today 00:00, Tomorrow 00:00 - array( + [ gmdate('Y-m-d', strtotime('yesterday')) . ' 00:00', false, 'Yesterday 00:00', - ), - array( + ], + [ gmdate('Y-m-d', strtotime('today')) . ' 00:00', false, 'Today 00:00', - ), - array( + ], + [ gmdate('Y-m-d', strtotime('tomorrow')) . ' 00:00', false, 'Tomorrow 00:00', - ), - ); + ], + ]; } /** @@ -124,24 +142,8 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_relative_format_date($timestamp, $forcedate, $expected) { - global $phpbb_root_path, $phpEx; - - $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->timezone = new DateTimeZone('UTC'); - $user->lang['datetime'] = array( - 'TODAY' => 'Today', - 'TOMORROW' => 'Tomorrow', - 'YESTERDAY' => 'Yesterday', - 'AGO' => array( - 0 => 'less than a minute ago', - 1 => '%d minute ago', - 2 => '%d minutes ago', - ), - ); - - $timestamp = $user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); + $this->user->timezone = new DateTimeZone('UTC'); + $timestamp = $this->user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); /* This code is equal to the one from \phpbb\datetime function format() * If the delta is less than or equal to 1 hour @@ -156,9 +158,9 @@ class phpbb_datetime_from_format_test extends phpbb_test_case ($delta >= -5 || (($now_ts/ 60) % 60) == (($timestamp / 60) % 60)) ) { - $expected = $user->lang(['datetime', 'AGO'], max(0, (int) floor($delta / 60))); + $expected = $this->lang->lang(['datetime', 'AGO'], max(0, (int) floor($delta / 60))); } - $this->assertEquals($expected, $user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); + $this->assertEquals($expected, $this->user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); } } diff --git a/tests/dbal/migrator_tool_config_text_test.php b/tests/dbal/migrator_tool_config_text_test.php index f1b009b5cd..d680b963d7 100644 --- a/tests/dbal/migrator_tool_config_text_test.php +++ b/tests/dbal/migrator_tool_config_text_test.php @@ -13,6 +13,10 @@ class phpbb_dbal_migrator_tool_config_text_test extends phpbb_database_test_case { + protected $db; + protected $config_text; + protected $tool; + public function getDataSet() { return $this->createXMLDataSet(__DIR__.'/fixtures/migrator_config_text.xml'); diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 5950c5e920..db63394b94 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -16,6 +16,11 @@ require_once __DIR__ . '/ext/foo/bar/ucp/ucp_test_info.php'; class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { + protected $db; + protected $cache; + protected $user; + protected $tool; + public function getDataSet() { return $this->createXMLDataSet(__DIR__.'/fixtures/migrator_module.xml'); diff --git a/tests/dbal/migrator_tool_permission_role_test.php b/tests/dbal/migrator_tool_permission_role_test.php index 2964189b49..3bebfe238d 100644 --- a/tests/dbal/migrator_tool_permission_role_test.php +++ b/tests/dbal/migrator_tool_permission_role_test.php @@ -22,6 +22,12 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_ /** @var \phpbb\db\migration\tool\permission */ protected $tool; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\service */ + protected $cache; + public $group_ids = [ 'REGISTERED' => 2, 'GLOBAL_MODERATORS' => 4, diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index d9c700a490..c4e74f23d4 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -16,6 +16,12 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case /** @var \phpbb\auth\auth */ protected $auth; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\service */ + protected $cache; + /** @var \phpbb\db\migration\tool\permission */ protected $tool; diff --git a/tests/email/email_parsing_test.php b/tests/email/email_parsing_test.php index 7ad6e64e6e..574babea81 100644 --- a/tests/email/email_parsing_test.php +++ b/tests/email/email_parsing_test.php @@ -19,6 +19,9 @@ class phpbb_email_parsing_test extends phpbb_test_case /** @var \ReflectionProperty */ protected $reflection_template_property; + /** @var \phpbb\messenger\method\email */ + protected $email; + protected function setUp(): void { global $phpbb_container, $config, $phpbb_root_path, $phpEx, $request, $user; diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index 3079ca1ffe..cb8984a3a1 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -24,7 +24,7 @@ class phpbb_error_collector_test extends phpbb_test_case public function test_collection() { - $collector = new \phpbb\error_collector(E_ALL | E_STRICT); // php set_error_handler() default + $collector = new \phpbb\error_collector(E_ALL | E_NOTICE); // php set_error_handler() default $collector->install(); // Cause a warning diff --git a/tests/functional/jumpbox_test.php b/tests/functional/jumpbox_test.php index 9e2938f9e2..9acaf5ee62 100644 --- a/tests/functional/jumpbox_test.php +++ b/tests/functional/jumpbox_test.php @@ -16,6 +16,8 @@ */ class phpbb_functional_jumpbox_test extends phpbb_functional_test_case { + protected $crawler; + public function test_jumpbox() { $this->login(); diff --git a/tests/messenger/method_base_test.php b/tests/messenger/method_base_test.php index 38e7a921b1..4c6e90e84c 100644 --- a/tests/messenger/method_base_test.php +++ b/tests/messenger/method_base_test.php @@ -37,6 +37,8 @@ class phpbb_messenger_method_base_test extends \phpbb_test_case protected $twig_extensions_collection; protected $twig_lexer; protected $user; + protected $filesystem; + protected $symfony_request; public function setUp(): void { diff --git a/tests/messenger/method_email_test.php b/tests/messenger/method_email_test.php index 650cf28a4e..84346c5298 100644 --- a/tests/messenger/method_email_test.php +++ b/tests/messenger/method_email_test.php @@ -37,6 +37,8 @@ class phpbb_messenger_method_email_test extends \phpbb_test_case protected $twig_extensions_collection; protected $twig_lexer; protected $user; + protected $filesystem; + protected $symfony_request; public function setUp(): void { diff --git a/tests/messenger/queue_test.php b/tests/messenger/queue_test.php index 3f87de91fc..a7f336b14a 100644 --- a/tests/messenger/queue_test.php +++ b/tests/messenger/queue_test.php @@ -18,6 +18,7 @@ use phpbb\messenger\queue; class phpbb_messenger_queue_test extends phpbb_test_case { protected $config; + protected $cache_file; protected $dispatcher; protected $service_collection; diff --git a/tests/migrations/migrations_check_config_added_test.php b/tests/migrations/migrations_check_config_added_test.php index 13d8b834a6..71c5ee7f07 100644 --- a/tests/migrations/migrations_check_config_added_test.php +++ b/tests/migrations/migrations_check_config_added_test.php @@ -43,6 +43,9 @@ class migrations_check_config_added_test extends phpbb_test_case /** @var string */ protected $php_ext; + /** @var string */ + protected $schema_data; + protected function setUp(): void { global $phpbb_root_path; diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php index 7bc434e33c..59869454bc 100644 --- a/tests/migrator/convert_timezones_test.php +++ b/tests/migrator/convert_timezones_test.php @@ -15,6 +15,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case { protected $db; protected $db_doctrine; + protected $migration; public function getDataSet() { diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php index 47b85ccc1c..02ee53e172 100644 --- a/tests/migrator/get_callable_from_step_test.php +++ b/tests/migrator/get_callable_from_step_test.php @@ -13,6 +13,9 @@ class get_callable_from_step_test extends phpbb_database_test_case { + protected $migrator; + protected $module_added; + protected function setUp(): void { global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log, $user; diff --git a/tests/migrator/get_schema_steps_test.php b/tests/migrator/get_schema_steps_test.php index 8c3e88209a..71f9baaef2 100644 --- a/tests/migrator/get_schema_steps_test.php +++ b/tests/migrator/get_schema_steps_test.php @@ -13,6 +13,8 @@ class get_schema_steps_test extends phpbb_test_case { + protected $helper; + protected function setUp(): void { parent::setUp(); diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index b46882a0fb..e7129c4cc3 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -21,9 +21,30 @@ require_once __DIR__ . '/../dbal/migration/dummy_order_5.php'; class schema_generator_test extends phpbb_test_case { + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\db\tools\doctrine */ + protected $db_tools; + + /** @var \Doctrine\DBAL\Connection */ + protected $doctrine_db; + /** @var \phpbb\db\migration\schema_generator */ protected $generator; + /** @var string */ + protected $table_prefix; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + protected function setUp(): void { global $phpbb_root_path, $phpEx; diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index cccf189680..8333f9542c 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -27,6 +27,12 @@ class guesser_test extends \phpbb_test_case protected $fileinfo_supported = false; + protected $guesser; + protected $guesser_no_fileinfo; + protected $path; + protected $jpg_file; + protected $phpbb_root_path; + protected function setUp(): void { global $phpbb_root_path; diff --git a/tests/mock/user.php b/tests/mock/user.php index 38d6bef2eb..f6bf0166e1 100644 --- a/tests/mock/user.php +++ b/tests/mock/user.php @@ -25,6 +25,8 @@ class phpbb_mock_user public $data = []; public $lang = []; public $ip = ''; + public $module; + public $session_id; private $options = array(); public function optionget($item, $data = false) diff --git a/tests/notification/base.php b/tests/notification/base.php index ec6319c420..a018191d66 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -21,7 +21,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case { /** @var phpbb_notification_manager_helper */ protected $notifications; - protected $db, $container, $user, $config, $auth, $cache; + protected $db, $container, $user, $config, $auth, $cache, $user_loader, $phpbb_dispatcher; protected function get_notification_types() { diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 6c1f7b496e..b890b47599 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -14,7 +14,9 @@ require_once __DIR__ . '/../mock/sql_insert_buffer.php'; class phpbb_notification_convert_test extends phpbb_database_test_case { - protected $notifications, $db, $doctrine_db, $container, $user, $config, $auth, $cache; + protected $db; + protected $doctrine_db; + protected $migration; public function getDataSet() { diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index f0efb9fd22..d90a4736a8 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -19,8 +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 $db; protected $item_type = ''; protected $poll_data = array(); diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 40b228f6bc..51b2f8752b 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -15,6 +15,10 @@ require_once __DIR__ . '/../template/template_test_case.php'; class phpbb_pagination_pagination_test extends phpbb_template_template_test_case { + protected $config; + protected $helper; + protected $routing_helper; + protected $pagination; protected $test_path = 'tests/pagination'; public function return_callback_implode() diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php index d32f9bf9a8..d690979a8d 100644 --- a/tests/passwords/drivers_test.php +++ b/tests/passwords/drivers_test.php @@ -13,6 +13,9 @@ class phpbb_passwords_drivers_test extends \phpbb_test_case { + /** @var \phpbb\passwords\driver\helper */ + protected $driver_helper = []; + /** @var array */ protected $passwords_drivers = []; diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index b7ccda3579..679ce99256 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -34,10 +34,11 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case ->will($this->returnCallback(array($this, 'create_datetime_callback'))); $this->user->timezone = new DateTimeZone('UTC'); - $this->user->lang = array( - 'datetime' => array(), - 'DATE_FORMAT' => 'm/d/Y', - ); + $this->user->expects($this->any()) + ->method('__get')->with('lang')->willReturn([ + 'datetime' => [], + 'DATE_FORMAT' => 'm/d/Y', + ]); $request = $this->createMock('\phpbb\request\request'); $template = $this->createMock('\phpbb\template\template'); diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 92a0d52dc4..8f74d23e6d 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -17,6 +17,7 @@ class phpbb_search_native_test extends phpbb_search_test_case { protected $db; protected $db_tools; + protected $search; public function getDataSet() { diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index 36e9fe6d3f..a73a9eaf3d 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -31,6 +31,7 @@ class phpbb_session_testable_factory protected $config; protected $cache; protected $request; + protected $server_data; /** * Initialises the factory with a set of default config and cache values. diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index a495f8aff8..6b76e97ae4 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -15,6 +15,9 @@ require_once __DIR__ . '/template_test_case.php'; class phpbb_template_allfolder_test extends phpbb_template_template_test_case { + protected $extension_manager; + protected $ext_template_path; + public function test_allfolder() { $this->setup_engine_for_allfolder(); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index a485c0b552..701c7f99ee 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -15,6 +15,8 @@ require_once __DIR__ . '/template_test_case.php'; class phpbb_template_template_events_test extends phpbb_template_template_test_case { + protected $extension_manager; + public static function template_data() { return array( diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index e695d05062..ca301b9b3e 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -60,14 +60,15 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ); $user->style = array('style_id' => 1); - $user->lang = array( - 'NO_POLL_TITLE' => 'You have to enter a poll title.', - 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', - 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', - 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', - 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', - 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', - ); + $user->expects($this->any()) + -> method('__get')->with('lang')->willReturn([ + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + ]); $phpbb_container = new phpbb_mock_container_builder; $phpbb_container->set('user', $user); diff --git a/tests/ucp/controller_webpush_test.php b/tests/ucp/controller_webpush_test.php index 2e5fb90ab7..e1e5373862 100644 --- a/tests/ucp/controller_webpush_test.php +++ b/tests/ucp/controller_webpush_test.php @@ -70,6 +70,7 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case $this->request = $this->createMock(\phpbb\request\request_interface::class); $this->template = $this->createMock(\Twig\Environment::class); $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); + $user = $this->user; $this->user_loader = new \phpbb\user_loader($this->avatar_helper, $this->db, $this->phpbb_root_path, $this->php_ext, 'phpbb_users'); $this->path_helper = new \phpbb\path_helper($symfony_request, $this->request, $phpbb_root_path, $phpEx); @@ -216,9 +217,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => 2, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification(); @@ -274,9 +272,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => ANONYMOUS, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification(); @@ -332,9 +327,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => ANONYMOUS, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $this->expectException(http_exception::class); $this->expectExceptionMessage('NO_AUTH_OPERATION'); @@ -382,9 +374,6 @@ class test_ucp_controller_webpush_test extends phpbb_database_test_case 'user_id' => 2, 'user_options' => 230271, ]; - $this->user->lang = [ - 'GUEST' => 'Guest', - ]; $json_response = $this->controller->notification();