mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/16512] Add user_ipwhois() test which internally uses make_clickable()
PHPBB3-16512
This commit is contained in:
parent
f340e8ca04
commit
68122fca27
1 changed files with 51 additions and 0 deletions
51
tests/functions_user/whois_test.php
Normal file
51
tests/functions_user/whois_test.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package testing
|
||||||
|
* @copyright (c) 2020 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php';
|
||||||
|
|
||||||
|
class phpbb_functions_user_whois_test extends phpbb_test_case
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
global $config, $phpbb_dispatcher, $user, $request, $symfony_request, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
$user = $this->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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue