xref: /PHP-8.4/ext/sysvshm/tests/001.phpt (revision 5853cdb7)
1--TEST--
2ftok() tests
3--EXTENSIONS--
4sysvshm
5--SKIPIF--
6<?php
7
8if (!function_exists('ftok')){ print 'skip'; }
9?>
10--FILE--
11<?php
12
13try {
14    ftok("","");
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18
19try {
20    ftok(-1, -1);
21} catch (\ValueError $e) {
22    echo $e->getMessage() . \PHP_EOL;
23}
24
25try {
26    ftok("qwertyu","qwertyu");
27} catch (\ValueError $e) {
28    echo $e->getMessage() . \PHP_EOL;
29}
30
31var_dump(ftok("nonexistentfile","q"));
32
33var_dump(ftok(__FILE__,"q"));
34
35echo "Done\n";
36?>
37--EXPECTF--
38ftok(): Argument #1 ($filename) must not be empty
39ftok(): Argument #2 ($project_id) must be a single character
40ftok(): Argument #2 ($project_id) must be a single character
41
42Warning: ftok(): ftok() failed - No such file or directory in %s on line %d
43int(-1)
44int(%d)
45Done
46