Skip to content

Commit a4ad111

Browse files
committed
Strict type tests
1 parent df3a523 commit a4ad111

File tree

11 files changed

+22
-0
lines changed

11 files changed

+22
-0
lines changed

tests/001.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ extension_loaded pcap
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
var_dump(extension_loaded('pcap'));
911

1012
print "done!";

tests/002.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ stream_get_wrappers pcap
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
var_dump(in_array('pcap', stream_get_wrappers()));
911

1012
print "done!";

tests/003.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fopen devices from net_get_interfaces
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
$devs = 0;
911

1012
foreach (array_keys(net_get_interfaces()) as $dev) {

tests/004.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fopen against bogus devices
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
$fp = fopen('pcap://' . uniqid('bogus'), 'r');
911
var_dump($fp);
1012

tests/005.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fopen against bogus URLs
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
$dev = current(array_keys(net_get_interfaces()));
911
if (!$dev) {
1012
die('Cannot find any viable network devices');

tests/006.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fopen without privileges
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
$dev = current(array_keys(net_get_interfaces()));
911
if (!$dev) {
1012
die('Cannot find any viable network devices');

tests/007.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fread ICMP ping traffic
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
require('helpers.php');
911

1012
$ip = gethostbyname('example.com');

tests/008.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fread UDP DNS traffic
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
require('helpers.php');
911

1012
// Use OpenDNS public nameservers

tests/009.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fread TCP HTTP traffic
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
require('helpers.php');
911

1012
$ip = gethostbyname('example.com');

tests/010.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ fwrite/fread ARP to IPv4 gateway
55
--FILE--
66
<?php
77

8+
declare(strict_types = 1);
9+
810
require('helpers.php');
911

1012
$dev = $gw = null;

tests/helpers.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
function parseLinuxSLLFrame(string $body): array {
46
$ret = unpack('npacketType/narphrd/naddressLength', $body);
57
$ret['address'] = formatEtherAddr(substr($body, 6, $ret['addressLength']));

0 commit comments

Comments
 (0)