Annotation of embedaddon/php/ext/standard/tests/file/flock.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: flock() tests
                      3: --FILE--
                      4: <?php
                      5: 
                      6: $file = dirname(__FILE__)."/flock.dat";
                      7: 
                      8: var_dump(flock());
                      9: var_dump(flock("", "", $var));
                     10: 
                     11: $fp = fopen($file, "w");
                     12: fclose($fp);
                     13: 
                     14: var_dump(flock($fp, LOCK_SH|LOCK_NB));
                     15: 
                     16: $fp = fopen($file, "w");
                     17: 
                     18: var_dump(flock($fp, LOCK_SH|LOCK_NB));
                     19: var_dump(flock($fp, LOCK_UN));
                     20: var_dump(flock($fp, LOCK_EX));
                     21: var_dump(flock($fp, LOCK_UN));
                     22: 
                     23: $would = array(1,2,3);
                     24: var_dump(flock($fp, LOCK_SH|LOCK_NB, $would));
                     25: var_dump($would);
                     26: var_dump(flock($fp, LOCK_UN, $would));
                     27: var_dump($would);
                     28: var_dump(flock($fp, LOCK_EX, $would));
                     29: var_dump($would);
                     30: var_dump(flock($fp, LOCK_UN, $would));
                     31: var_dump($would);
                     32: 
                     33: var_dump(flock($fp, -1));
                     34: var_dump(flock($fp, 0));
                     35: 
                     36: @unlink($file);
                     37: echo "Done\n";
                     38: ?>
                     39: --EXPECTF--    
                     40: Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
                     41: NULL
                     42: 
                     43: Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
                     44: NULL
                     45: 
                     46: Warning: flock(): %d is not a valid stream resource in %s on line %d
                     47: bool(false)
                     48: bool(true)
                     49: bool(true)
                     50: bool(true)
                     51: bool(true)
                     52: bool(true)
                     53: int(0)
                     54: bool(true)
                     55: int(0)
                     56: bool(true)
                     57: int(0)
                     58: bool(true)
                     59: int(0)
                     60: bool(true)
                     61: 
                     62: Warning: flock(): Illegal operation argument in %s on line %d
                     63: bool(false)
                     64: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>