diff options
Diffstat (limited to 'tests/functions')
21 files changed, 14 insertions, 108 deletions
diff --git a/tests/functions/build_hidden_fields_for_query_params_test.php b/tests/functions/build_hidden_fields_for_query_params_test.php index 14cb4b9a94..aee7a569d4 100644 --- a/tests/functions/build_hidden_fields_for_query_params_test.php +++ b/tests/functions/build_hidden_fields_for_query_params_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_build_hidden_fields_for_query_params_test extends phpbb_test_case { public function build_hidden_fields_for_query_params_test_data() diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index a59b94c744..91a4a9ec66 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_build_url_test extends phpbb_test_case { protected function setUp() @@ -29,7 +27,7 @@ class phpbb_build_url_test extends phpbb_test_case new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), + new \phpbb\filesystem\filesystem(), $this->getMock('\phpbb\request\request'), $phpbb_root_path, 'php' diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index 729c0a82f0..e46a569565 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -11,14 +11,11 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case { public function convert_30_dbms_to_31_data() { return array( - array('mssql'), array('mssql_odbc'), array('mssqlnative'), array('mysql'), diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php index cd1e37618a..6eddb1395e 100644 --- a/tests/functions/generate_string_list.php +++ b/tests/functions/generate_string_list.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_generate_string_list_test extends phpbb_test_case { public $user; @@ -22,7 +19,12 @@ class phpbb_generate_string_list_test extends phpbb_test_case { parent::setUp(); - $this->user = new \phpbb\user('\phpbb\datetime'); + 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'); + $this->user = $user; $this->user->data = array('user_lang' => 'en'); $this->user->add_lang('common'); } @@ -36,7 +38,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case ), array( array('A'), - 'A', + 'A', ), array( array(2 => 'A', 3 => 'B'), diff --git a/tests/functions/get_formatted_filesize_test.php b/tests/functions/get_formatted_filesize_test.php index 635753d737..290515b64f 100644 --- a/tests/functions/get_formatted_filesize_test.php +++ b/tests/functions/get_formatted_filesize_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_get_formatted_filesize_test extends phpbb_test_case { public function get_formatted_filesize_test_data() diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php index e74017d315..b8254b03ea 100644 --- a/tests/functions/get_preg_expression_test.php +++ b/tests/functions/get_preg_expression_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_functions_get_preg_expression_test extends phpbb_test_case { public function data_path_remove_dot_trailing_slash() diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php index 612d82273e..1550aa37e6 100644 --- a/tests/functions/get_remote_file_test.php +++ b/tests/functions/get_remote_file_test.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; - /** * @group slow */ diff --git a/tests/functions/is_absolute_test.php b/tests/functions/is_absolute_test.php deleted file mode 100644 index afa4b9b59f..0000000000 --- a/tests/functions/is_absolute_test.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - -class phpbb_functions_is_absolute_test extends phpbb_test_case -{ - static public function is_absolute_data() - { - return array( - // Empty - array('', false), - - // Absolute unix style - array('/etc/phpbb', true), - // Unix does not support \ so that is not an absolute path - array('\etc\phpbb', false), - - // Absolute windows style - array('c:\windows', true), - array('C:\Windows', true), - array('c:/windows', true), - array('C:/Windows', true), - - // Executable - array('etc/phpbb', false), - array('explorer.exe', false), - - // Relative subdir - array('Windows\System32', false), - array('Windows\System32\explorer.exe', false), - array('Windows/System32', false), - array('Windows/System32/explorer.exe', false), - - // Relative updir - array('..\Windows\System32', false), - array('..\Windows\System32\explorer.exe', false), - array('../Windows/System32', false), - array('../Windows/System32/explorer.exe', false), - ); - } - - /** - * @dataProvider is_absolute_data - */ - public function test_is_absolute($path, $expected) - { - $this->assertEquals($expected, phpbb_is_absolute($path)); - } -} diff --git a/tests/functions/language_select_test.php b/tests/functions/language_select_test.php index 6762ead5a1..2d1296d72f 100644 --- a/tests/functions/language_select_test.php +++ b/tests/functions/language_select_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_functions_language_select_test extends phpbb_database_test_case { public function getDataSet() diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php index 4c802d0487..f32b4339a8 100644 --- a/tests/functions/make_clickable_email_test.php +++ b/tests/functions/make_clickable_email_test.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; - class phpbb_functions_make_clickable_email_test extends phpbb_test_case { protected function setUp() diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php index 63beeb06b2..48fc2c19fb 100644 --- a/tests/functions/make_clickable_test.php +++ b/tests/functions/make_clickable_test.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; - class phpbb_functions_make_clickable_test extends phpbb_test_case { /** diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index e793a4eb82..778753e5d2 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; - class phpbb_functions_obtain_online_test extends phpbb_database_test_case { public function getDataSet() diff --git a/tests/functions/parse_cfg_file_test.php b/tests/functions/parse_cfg_file_test.php index b47e25fbc1..017a931f28 100644 --- a/tests/functions/parse_cfg_file_test.php +++ b/tests/functions/parse_cfg_file_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_functions_parse_cfg_file extends phpbb_test_case { public function parse_cfg_file_data() diff --git a/tests/functions/quoteattr_test.php b/tests/functions/quoteattr_test.php index 6e191f9610..dbad7a99d8 100644 --- a/tests/functions/quoteattr_test.php +++ b/tests/functions/quoteattr_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_quoteattr_test extends phpbb_test_case { public function quoteattr_test_data() diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php index a918f83155..27f0e68c88 100644 --- a/tests/functions/style_select_test.php +++ b/tests/functions/style_select_test.php @@ -11,8 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - class phpbb_functions_style_select_test extends phpbb_database_test_case { public function getDataSet() diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index c224323273..db9b6e0c90 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -11,7 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; class phpbb_functions_user_delete_test extends phpbb_database_test_case @@ -28,10 +27,12 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case { parent::setUp(); - global $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user; + global $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx; $this->db = $db = $this->new_dbal(); - $user = new \phpbb\user('\phpbb\datetime'); + $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'); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $config = new \phpbb\config\config(array( @@ -39,8 +40,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case 'auth_oauth_google_key' => 'foo', 'auth_oauth_google_secret' => 'bar', )); - set_config_count('foobar', 0, false, $config); - $cache = new \phpbb\cache\driver\null(); + $cache = new \phpbb\cache\driver\dummy(); $request = new phpbb_mock_request(); $notification_manager = new phpbb_mock_notification_manager(); $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config); @@ -67,6 +67,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case $request, $user, 'phpbb_oauth_tokens', + 'phpbb_oauth_states', 'phpbb_oauth_accounts', $oauth_provider_collection, 'phpbb_users', diff --git a/tests/functions/validate_email_test.php b/tests/functions/validate_email_test.php index b46509fda7..7f8b2679d4 100644 --- a/tests/functions/validate_email_test.php +++ b/tests/functions/validate_email_test.php @@ -7,7 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; require_once dirname(__FILE__) . '/../mock/user.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index c5942e79bf..5e34c8baba 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -11,7 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; diff --git a/tests/functions/validate_string_test.php b/tests/functions/validate_string_test.php index 24026e4c9f..7aca14c334 100644 --- a/tests/functions/validate_string_test.php +++ b/tests/functions/validate_string_test.php @@ -12,7 +12,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; class phpbb_functions_validate_string_test extends phpbb_test_case diff --git a/tests/functions/validate_user_email_test.php b/tests/functions/validate_user_email_test.php index 951d5794e6..8dcec88103 100644 --- a/tests/functions/validate_user_email_test.php +++ b/tests/functions/validate_user_email_test.php @@ -11,7 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; require_once dirname(__FILE__) . '/../mock/user.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index 4fa5af7ff3..d310f58036 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -11,9 +11,7 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; |