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

1.1       misho       1: --TEST--
                      2: touch() tests
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) == 'WIN') {
                      6:     die('skip.. only for Non Windows.');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: 
                     12: // This doesn't work for windows, time, atime usage results in very different
                     13: // output to linux. This could be a php.net bug on windows or a windows querk.
                     14: $filename = dirname(__FILE__)."/touch.dat";
                     15: 
                     16: var_dump(touch());
                     17: var_dump(touch($filename));
                     18: var_dump(filemtime($filename));
                     19: @unlink($filename);
                     20: var_dump(touch($filename, 101));
                     21: var_dump(filemtime($filename));
                     22: 
                     23: @unlink($filename);
                     24: var_dump(touch($filename, -1));
                     25: var_dump(filemtime($filename));
                     26: 
                     27: @unlink($filename);
                     28: var_dump(touch($filename, 100, 100));
                     29: var_dump(filemtime($filename));
                     30: 
                     31: @unlink($filename);
                     32: var_dump(touch($filename, 100, -100));
                     33: var_dump(filemtime($filename));
                     34: 
                     35: var_dump(touch("/no/such/file/or/directory"));
                     36: 
                     37: @unlink($filename);
                     38: 
                     39: echo "Done\n";
                     40: ?>
                     41: --EXPECTF--    
                     42: Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
                     43: NULL
                     44: bool(true)
                     45: int(%d)
                     46: bool(true)
                     47: int(101)
                     48: bool(true)
                     49: int(%i)
                     50: bool(true)
                     51: int(100)
                     52: bool(true)
                     53: int(100)
                     54: 
                     55: Warning: touch(): Unable to create file /no/such/file/or/directory because %s in %s on line %d
                     56: bool(false)
                     57: Done
                     58: 

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