diff options
Diffstat (limited to 'tests/functions')
21 files changed, 58 insertions, 34 deletions
diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 91a4a9ec66..1519549d3e 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -13,7 +13,7 @@ class phpbb_build_url_test extends phpbb_test_case { - protected function setUp() + protected function setUp(): void { global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper; @@ -28,7 +28,7 @@ class phpbb_build_url_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\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 456eb64461..05c42610bb 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -18,7 +18,6 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case return array( array('mssql_odbc'), array('mssqlnative'), - array('mysql'), array('mysqli'), array('oracle'), array('postgres'), diff --git a/tests/functions/fixtures/validate_email.xml b/tests/functions/fixtures/validate_email.xml index fa139f6f18..985050cedc 100644 --- a/tests/functions/fixtures/validate_email.xml +++ b/tests/functions/fixtures/validate_email.xml @@ -30,14 +30,14 @@ <column>username_clean</column> <column>user_permissions</column> <column>user_sig</column> - <column>user_email_hash</column> + <column>user_email</column> <row> <value>1</value> <value>admin</value> <value>admin</value> <value></value> <value></value> - <value>143317126117</value> + <value>admin@example.com</value> </row> </table> </dataset> diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php index 6eddb1395e..0f9975bcac 100644 --- a/tests/functions/generate_string_list.php +++ b/tests/functions/generate_string_list.php @@ -15,7 +15,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case { public $user; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php index 75e5a6dc61..b783e3c297 100644 --- a/tests/functions/get_remote_file_test.php +++ b/tests/functions/get_remote_file_test.php @@ -24,7 +24,7 @@ class phpbb_functions_get_remote_file extends phpbb_test_case $hostname = 'version.phpbb.com'; - if (!phpbb_checkdnsrr($hostname, 'A')) + if (!checkdnsrr($hostname, 'A')) { $this->markTestSkipped(sprintf( 'Could not find a DNS record for hostname %s. ' . diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php index d481bde80d..18ad789705 100644 --- a/tests/functions/make_clickable_email_test.php +++ b/tests/functions/make_clickable_email_test.php @@ -13,7 +13,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php index a6af12b624..d8d5eb5e0e 100644 --- a/tests/functions/make_clickable_test.php +++ b/tests/functions/make_clickable_test.php @@ -154,7 +154,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case ); } - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 778753e5d2..e6929b1549 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -18,7 +18,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/obtain_online.xml'); } - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -161,8 +161,9 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case global $config, $user, $auth, $phpbb_dispatcher; $config['load_online_guests'] = $display_guests; $user = new phpbb_mock_lang(); + $user->data['user_id'] = 100; $user->lang = $this->load_language(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $acl_get_map = array( array('u_viewonline', true), array('u_viewprofile', true), diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php index 6f7607132e..e1cb7a4636 100644 --- a/tests/functions/phpbb_get_banned_user_ids.php +++ b/tests/functions/phpbb_get_banned_user_ids.php @@ -43,13 +43,13 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case ); } - public function setUp() + public function setUp(): void { global $db; $db = $this->new_dbal(); - return parent::setUp(); + parent::setUp(); } /** diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index f419c90e9e..f4ea5696b9 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -23,7 +23,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_delete.xml'); } - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -60,21 +60,43 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case // Set up passwords manager $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers)); - $oauth_provider = new \phpbb\auth\provider\oauth\oauth( - $db, + $plugins = new \phpbb\di\service_collection($phpbb_container); + $plugins->add('core.captcha.plugins.nogd'); + $phpbb_container->set( + 'captcha.factory', + new \phpbb\captcha\factory($phpbb_container, $plugins) + ); + $phpbb_container->set( + 'core.captcha.plugins.nogd', + new \phpbb\captcha\plugins\nogd() + ); + // Set up passwords manager + $db_auth_provider = new \phpbb\auth\provider\db( + new \phpbb\captcha\factory($phpbb_container, $plugins), $config, + $db, $passwords_manager, $request, $user, + $phpbb_root_path, + $phpEx + ); + + $oauth_provider = new \phpbb\auth\provider\oauth\oauth( + $config, + $db, + $db_auth_provider, + $phpbb_dispatcher, + $lang, + $request, + $oauth_provider_collection, + $user, 'phpbb_oauth_tokens', 'phpbb_oauth_states', 'phpbb_oauth_accounts', - $oauth_provider_collection, 'phpbb_users', - $phpbb_container, - $phpbb_dispatcher, - $this->phpbb_root_path, - $this->php_ext + $phpbb_root_path, + $phpEx ); $provider_collection->offsetSet('auth.provider.oauth', $oauth_provider); diff --git a/tests/functions/validate_date_test.php b/tests/functions/validate_date_test.php index 9dc0db46d6..cd4e7430f3 100644 --- a/tests/functions/validate_date_test.php +++ b/tests/functions/validate_date_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_date_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_email_test.php b/tests/functions/validate_email_test.php index 7f8b2679d4..e163d01412 100644 --- a/tests/functions/validate_email_test.php +++ b/tests/functions/validate_email_test.php @@ -22,7 +22,7 @@ class phpbb_functions_validate_email_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/validate_email.xml'); } - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_jabber_test.php b/tests/functions/validate_jabber_test.php index 23811a94c0..dbdf10cb4a 100644 --- a/tests/functions/validate_jabber_test.php +++ b/tests/functions/validate_jabber_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_jabber_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -32,7 +32,7 @@ class phpbb_functions_validate_jabber_test extends phpbb_test_case array(), '', array('jabber'), - ), + ), 'no_seperator' => array( array('WRONG_DATA'), 'testjabber.ccc', diff --git a/tests/functions/validate_lang_iso_test.php b/tests/functions/validate_lang_iso_test.php index 81b56055e6..cbe5339ea5 100644 --- a/tests/functions/validate_lang_iso_test.php +++ b/tests/functions/validate_lang_iso_test.php @@ -24,7 +24,7 @@ class phpbb_functions_validate_lang_iso_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/language_select.xml'); } - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_match_test.php b/tests/functions/validate_match_test.php index 811bed3e33..7159686066 100644 --- a/tests/functions/validate_match_test.php +++ b/tests/functions/validate_match_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_match_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_num_test.php b/tests/functions/validate_num_test.php index 798468759c..acbdc49614 100644 --- a/tests/functions/validate_num_test.php +++ b/tests/functions/validate_num_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_num_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index 5e34c8baba..6e4ccea3ab 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_password_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_string_test.php b/tests/functions/validate_string_test.php index 7aca14c334..83ba546152 100644 --- a/tests/functions/validate_string_test.php +++ b/tests/functions/validate_string_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_string_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/functions/validate_user_email_test.php b/tests/functions/validate_user_email_test.php index d23ffc0503..eeb5bfc2a9 100644 --- a/tests/functions/validate_user_email_test.php +++ b/tests/functions/validate_user_email_test.php @@ -26,7 +26,7 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/validate_email.xml'); } - protected function setUp() + protected function setUp(): void { global $cache, $phpbb_dispatcher, $phpbb_root_path, $phpEx; diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index cee5d38400..31837f015b 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -26,7 +26,7 @@ class phpbb_functions_validate_data_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/validate_username.xml'); } - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -130,11 +130,13 @@ class phpbb_functions_validate_data_test extends phpbb_database_test_case */ public function test_validate_username($allow_name_chars, $expected) { - global $cache, $config, $db; + global $cache, $config, $db, $user; $db = $this->db; $cache = $this->cache; $cache->put('_disallowed_usernames', array('barfoo')); + $user = new phpbb_mock_user(); + $user->data['username_clean'] = 'username'; $config['allow_name_chars'] = $allow_name_chars; diff --git a/tests/functions/validate_with_method_test.php b/tests/functions/validate_with_method_test.php index 37e05d412a..1cd610fd2f 100644 --- a/tests/functions/validate_with_method_test.php +++ b/tests/functions/validate_with_method_test.php @@ -18,7 +18,7 @@ class phpbb_functions_validate_with_method_test extends phpbb_test_case { protected $helper; - protected function setUp() + protected function setUp(): void { parent::setUp(); |