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