From 68122fca273e6a29fc26b3733382bbd1cb6339f5 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 7 Jun 2020 13:35:38 +0700 Subject: [PATCH] [ticket/16512] Add user_ipwhois() test which internally uses make_clickable() PHPBB3-16512 --- tests/functions_user/whois_test.php | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/functions_user/whois_test.php diff --git a/tests/functions_user/whois_test.php b/tests/functions_user/whois_test.php new file mode 100644 index 0000000000..02cd3a5ebd --- /dev/null +++ b/tests/functions_user/whois_test.php @@ -0,0 +1,51 @@ +getMockBuilder('\phpbb\user') + ->setConstructorArgs([ + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime', + ]) + ->getMock(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $config = new \phpbb\config\config([]); + $request = $this->getMockBuilder('\phpbb\request\request') + ->getMock(); + $symfony_request = $this->getMockBuilder('\phpbb\symfony_request') + ->disableOriginalConstructor() + ->getMock(); + } + + public function ips_data() + { + return [ + ['2001:4860:4860::8888'], // Google public DNS + ['64.233.161.139'], // google.com + ]; + } + + /** + * @dataProvider ips_data + */ + public function test_ip_whois($ip) + { + $ip_whois = user_ipwhois($ip); + $this->assertNotContains('Query terms are ambiguous', $ip_whois); + $this->assertNotContains('no entries found', $ip_whois); + $this->assertNotContains('ERROR', $ip_whois); + } +}