php-src/ext/sysvshm/tests/001.phpt
Kalle Sommer Nielsen ceb1ea37ad Windows support for sysvshm
A little background:
* key_t is an int, like ext/shmop
* There is no ftok() (from ext/standard), so tests have a new check to see whether or not it is available. This however means that the 7 tests will all be skipped for Windows. I know we cannot properly implement an ftok() function since there is no inodes for NTFS, maybe we should look into using the GetFileInfoByHandle() or similar to use the system unique ID for a file to get the same functionality, Anatol?
* Despite the lack of phpt's, local testing works flawlessly but we better look into a solution for this if we are to keep this patch
2015-04-22 09:29:45 +02:00

48 lines
941 B
PHP

--TEST--
ftok() tests
--SKIPIF--
<?php
if (!extension_loaded("sysvshm")){ print 'skip'; }
if (!function_exists('ftok')){ print 'skip'; }
?>
--FILE--
<?php
var_dump(ftok());
var_dump(ftok(1));
var_dump(ftok(1,1,1));
var_dump(ftok("",""));
var_dump(ftok(-1, -1));
var_dump(ftok("qwertyu","qwertyu"));
var_dump(ftok("nonexistentfile","q"));
var_dump(ftok(__FILE__,"q"));
echo "Done\n";
?>
--EXPECTF--
Warning: ftok() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: ftok() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: ftok() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: ftok(): Pathname is invalid in %s on line %d
int(-1)
Warning: ftok(): Project identifier is invalid in %s on line %d
int(-1)
Warning: ftok(): Project identifier is invalid in %s on line %d
int(-1)
Warning: ftok(): ftok() failed - No such file or directory in %s on line %d
int(-1)
int(%d)
Done