-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathWhoisClientTest.php
More file actions
49 lines (45 loc) · 2.39 KB
/
WhoisClientTest.php
File metadata and controls
49 lines (45 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
use phpWhois\WhoisClient;
class WhoisClientTest extends \PHPUnit_Framework_TestCase
{
/*public function testVersion()
{
$client = new WhoisClient;
$this->assertRegExp('/^(\d+)\.(\d+)\.(\d+)(-\w+)*$/', $client->codeVersion);
}*/
/**
* @dataProvider serversProvider
*/
public function testParseServer($server, $result)
{
$whoisClient = new WhoisClient;
$this->assertEquals($result, $whoisClient->parseServer($server));
}
public function serversProvider()
{
return [
['http://www.phpwhois.pw:80/', ['scheme' => 'http', 'host' => 'www.phpwhois.pw', 'port' => 80]],
['http://www.phpwhois.pw:80', ['scheme' => 'http', 'host' => 'www.phpwhois.pw', 'port' => 80]],
['http://www.phpwhois.pw', ['scheme' => 'http', 'host' => 'www.phpwhois.pw']],
['www.phpwhois.pw:80', ['host' => 'www.phpwhois.pw', 'port' => 80]],
['www.phpwhois.pw:80/', ['host' => 'www.phpwhois.pw', 'port' => 80]],
['www.phpwhois.pw', ['host' => 'www.phpwhois.pw']],
['www.phpwhois.pw/', ['host' => 'www.phpwhois.pw']],
['http://127.0.0.1:80/', ['scheme' => 'http', 'host' => '127.0.0.1', 'port' => 80]],
['http://127.0.0.1:80', ['scheme' => 'http', 'host' => '127.0.0.1', 'port' => 80]],
['http://127.0.0.1', ['scheme' => 'http', 'host' => '127.0.0.1']],
['127.0.0.1:80', ['host' => '127.0.0.1', 'port' => 80]],
['127.0.0.1:80/', ['host' => '127.0.0.1', 'port' => 80]],
['127.0.0.1', ['host' => '127.0.0.1']],
['127.0.0.1/', ['host' => '127.0.0.1']],
['http://[1a80:1f45::ebb:12]:80/', ['scheme' => 'http', 'host' => '[1a80:1f45::ebb:12]', 'port' => 80]],
['http://[1a80:1f45::ebb:12]:80', ['scheme' => 'http', 'host' => '[1a80:1f45::ebb:12]', 'port' => 80]],
['http://[1a80:1f45::ebb:12]', ['scheme' => 'http', 'host' => '[1a80:1f45::ebb:12]']],
//['http://1a80:1f45::ebb:12', [scheme' => 'http', 'host' => '[1a80:1f45::ebb:12]']],
['[1a80:1f45::ebb:12]:80', ['host' => '[1a80:1f45::ebb:12]', 'port' => 80]],
['[1a80:1f45::ebb:12]:80/', ['host' => '[1a80:1f45::ebb:12]', 'port' => 80]],
['1a80:1f45::ebb:12', ['host' => '[1a80:1f45::ebb:12]']],
['1a80:1f45::ebb:12/', ['host' => '[1a80:1f45::ebb:12]']],
];
}
}