"Fossies" - the Fresh Open Source Software Archive 
Member "php-8.0.28-src/ext/sysvshm/tests/001.phpt" (14 Feb 2023, 813 Bytes) of package /windows/www/php-8.0.28-src.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 --TEST--
2 ftok() tests
3 --SKIPIF--
4 <?php
5 if (!extension_loaded("sysvshm")){ print 'skip'; }
6 if (!function_exists('ftok')){ print 'skip'; }
7 ?>
8 --FILE--
9 <?php
10
11 try {
12 ftok("","");
13 } catch (\ValueError $e) {
14 echo $e->getMessage() . \PHP_EOL;
15 }
16
17 try {
18 ftok(-1, -1);
19 } catch (\ValueError $e) {
20 echo $e->getMessage() . \PHP_EOL;
21 }
22
23 try {
24 ftok("qwertyu","qwertyu");
25 } catch (\ValueError $e) {
26 echo $e->getMessage() . \PHP_EOL;
27 }
28
29 var_dump(ftok("nonexistentfile","q"));
30
31 var_dump(ftok(__FILE__,"q"));
32
33 echo "Done\n";
34 ?>
35 --EXPECTF--
36 ftok(): Argument #1 ($filename) cannot be empty
37 ftok(): Argument #2 ($project_id) must be a single character
38 ftok(): Argument #2 ($project_id) must be a single character
39
40 Warning: ftok(): ftok() failed - No such file or directory in %s on line %d
41 int(-1)
42 int(%d)
43 Done