-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetwork.php
53 lines (39 loc) · 1.2 KB
/
Network.php
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
50
51
52
53
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <[email protected]>
* License: https://github.com/quidphp/base/blob/master/LICENSE
*/
namespace Quid\Test\Base;
use Quid\Base;
// network
// class for testing Quid\Base\Network
class Network extends Base\Test
{
// trigger
final public static function trigger(array $data):bool
{
// isOnline
// hasDns
// ping
// dns
// mx
// getHostname
// getIp
// getProtocolNumber
assert(Base\Network::getProtocolNumber('tcp') === 6);
assert(Base\Network::getProtocolNumber('tcpz') === null);
// getProtocolName
assert(Base\Network::getProtocolName(6) === 'tcp');
assert(Base\Network::getProtocolName(6000) === null);
// getServiceName
assert(Base\Network::getServiceName(80,'tcp') === 'http');
assert(Base\Network::getServiceName(81123,'tcp') === null);
// getServicePort
assert(Base\Network::getServicePort('http','tcp') === 80);
assert(Base\Network::getServicePort('httpz','tcpw') === null);
return true;
}
}
?>