Skip to content

Commit 5af4006

Browse files
committed
update tests
1 parent d0fcce3 commit 5af4006

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/posix/tests/posix_mknodat_mkfifoat.phpt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ posix_mknodat/posix_mkfifoat support
44
posix
55
--SKIPIF--
66
<?php
7-
if (!function_exists('posix_mknodat')) die('skip posix_mknodat() not found');
7+
// usually, mkfifoat is implemented with mknodat
8+
if (!function_exists('posix_mknodat') || !function_exists('posix_mkfifoat')) die('skip posix_mknodat()/posix_mkfifoat not found');
89
?>
910
--FILE--
1011
<?php
1112

1213
$fd = fopen(__DIR__, "r");
14+
var_dump(posix_mknodat($fd, 'dev', POSIX_S_IFIFO | 0666, 1, 0));
1315
var_dump(posix_mknodat($fd, '', POSIX_S_IFBLK | 0777, 1, 0));
1416
var_dump(posix_mknodat($fd, __DIR__ . '', POSIX_S_IFBLK | 0777, 1, 0));
1517
try {
@@ -22,14 +24,20 @@ var_dump(posix_mkfifoat($fd, __DIR__ . '', POSIX_S_IFBLK | 0777));
2224
try {
2325
posix_mkfifoat(new stdClass(), '/dev/', POSIX_S_IFBLK | 0777);
2426
} catch (TypeError $e) {
25-
echo $e->getMessage();
27+
echo $e->getMessage() . PHP_EOL;
2628
}
29+
@unlink(__DIR__ . '/dev');
30+
var_dump(posix_mkfifoat($fd, 'dev', POSIX_S_IFIFO | 0666));
2731
fclose($fd);
32+
@unlink(__DIR__ . '/dev');
2833
?>
2934
--EXPECT--
35+
bool(true)
3036
bool(false)
3137
bool(false)
3238
posix_mknodat(): Argument #4 ($major) cannot be 0 for the POSIX_S_IFCHR and POSIX_S_IFBLK modes
3339
bool(false)
3440
bool(false)
3541
posix_mkfifoat(): Argument #1 ($file_descriptor) must be of type int|resource, stdClass given
42+
bool(true)
43+

0 commit comments

Comments
 (0)