From 42b7782927713c2ca2fb704db6217016347b586e Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 19 Mar 2017 21:46:20 +0700 Subject: [ticket/14972] Migrate from deprecated getMock() method to createMock() PHPBB3-14972 --- tests/functions/build_url_test.php | 2 +- tests/functions/obtain_online_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/functions') diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 91a4a9ec66..a528cec5ae 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -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/obtain_online_test.php b/tests/functions/obtain_online_test.php index 778753e5d2..77b1079802 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -162,7 +162,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $config['load_online_guests'] = $display_guests; $user = new phpbb_mock_lang(); $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), -- cgit v1.2.1 From ebac54aa9e705e99a562d2fe2c0f57bc6af8dd32 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 30 Dec 2018 11:36:08 +0100 Subject: [ticket/14948] Adjust calls for twig and phpunit updates PHPBB3-14948 --- tests/functions/build_url_test.php | 2 +- tests/functions/generate_string_list.php | 2 +- tests/functions/make_clickable_email_test.php | 2 +- tests/functions/make_clickable_test.php | 2 +- tests/functions/obtain_online_test.php | 2 +- tests/functions/phpbb_get_banned_user_ids.php | 4 ++-- tests/functions/user_delete_test.php | 2 +- tests/functions/validate_date_test.php | 2 +- tests/functions/validate_email_test.php | 2 +- tests/functions/validate_jabber_test.php | 4 ++-- tests/functions/validate_lang_iso_test.php | 2 +- tests/functions/validate_match_test.php | 2 +- tests/functions/validate_num_test.php | 2 +- tests/functions/validate_password_test.php | 2 +- tests/functions/validate_string_test.php | 2 +- tests/functions/validate_user_email_test.php | 2 +- tests/functions/validate_username_test.php | 2 +- tests/functions/validate_with_method_test.php | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) (limited to 'tests/functions') diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index a528cec5ae..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; 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/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 77b1079802..f740decab8 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(); 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..89aecdefb9 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(); 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 8dcec88103..a05a7808a4 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 { parent::setUp(); diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index cee5d38400..3a4b63b5e8 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(); 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(); -- cgit v1.2.1 From bd02c5bd085e957aa4341e7fc2df2199081ab069 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Oct 2019 12:07:35 +0200 Subject: [ticket/16051] Remove mysql driver as it's no longer supported in PHP >= 7.0 PHPBB3-16051 --- tests/functions/convert_30_dbms_to_31_test.php | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/functions') 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'), -- cgit v1.2.1 From 163aac74dbe500eac223ea2ebdbce0a76c1d6ab4 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 31 Oct 2019 20:54:21 +0000 Subject: [ticket/16190] Deprecate phpbb's checkdnsrr wrapper PHPBB3-16190 --- tests/functions/get_remote_file_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/functions') 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. ' . -- cgit v1.2.1 From 0b39e4e854da85ea6fd59578e1623078012fcae2 Mon Sep 17 00:00:00 2001 From: mrgoldy Date: Sun, 5 May 2019 18:26:43 +0200 Subject: [ticket/16008] Clean up phpBB OAuth system PHPBB3-16008 --- tests/functions/user_delete_test.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/functions') diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index 89aecdefb9..83fda05542 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -61,20 +61,21 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers)); $oauth_provider = new \phpbb\auth\provider\oauth\oauth( - $db, $config, + $phpbb_container, + $db, + $phpbb_dispatcher, + $lang, $passwords_manager, $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); -- cgit v1.2.1 From f460194379ece85a0f53e737dbe736a1bdfe359c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 16 Nov 2019 23:05:36 +0100 Subject: [ticket/12574] Remove passwords manager & container requirement from oauth PHPBB3-12574 --- tests/functions/user_delete_test.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tests/functions') diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index 83fda05542..f4ea5696b9 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -60,13 +60,34 @@ 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)); + $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, - $phpbb_container, $db, + $db_auth_provider, $phpbb_dispatcher, $lang, - $passwords_manager, $request, $oauth_provider_collection, $user, -- cgit v1.2.1 From 9872316cac4df4987fdabc9512ca6ebeb7e5e04f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 18 Nov 2019 21:06:00 +0100 Subject: [ticket/16167] Remove uses of user_email_hash PHPBB3-16167 --- tests/functions/fixtures/validate_email.xml | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/functions') diff --git a/tests/functions/fixtures/validate_email.xml b/tests/functions/fixtures/validate_email.xml index fa139f6f18..f477c265e9 100644 --- a/tests/functions/fixtures/validate_email.xml +++ b/tests/functions/fixtures/validate_email.xml @@ -30,14 +30,12 @@ username_clean user_permissions user_sig - user_email_hash 1 admin admin - 143317126117 -- cgit v1.2.1 From 83d430419e86404bb54a813f853051dd9c696eb3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 18 Nov 2019 21:50:58 +0100 Subject: [ticket/16167] Adjust tests for actual duplicate email PHPBB3-16167 --- tests/functions/fixtures/validate_email.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/functions') diff --git a/tests/functions/fixtures/validate_email.xml b/tests/functions/fixtures/validate_email.xml index f477c265e9..985050cedc 100644 --- a/tests/functions/fixtures/validate_email.xml +++ b/tests/functions/fixtures/validate_email.xml @@ -30,12 +30,14 @@ username_clean user_permissions user_sig + user_email 1 admin admin + admin@example.com -- cgit v1.2.1 From dcab0762210a4059cca7458344dcc1aeb0360c42 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 29 Dec 2019 02:12:36 +0700 Subject: [ticket/16276] Further fix PHP nightly tests PHPBB3-16276 --- tests/functions/obtain_online_test.php | 1 + tests/functions/validate_username_test.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/functions') diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index f740decab8..e6929b1549 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -161,6 +161,7 @@ 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->createMock('\phpbb\auth\auth'); $acl_get_map = array( diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index 3a4b63b5e8..31837f015b 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -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; -- cgit v1.2.1