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

1.1       misho       1: --TEST--
                      2: Test symlink(), linkinfo(), link() and is_link() functions : error conditions - symlink & linkinfo
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) == 'WIN') {
                      6:     die('skip no symlinks on Windows');
                      7: }
                      8: if (substr(PHP_OS, 0, 3) == 'SUN') {
                      9:   die('skip Not valid for Sun Solaris');
                     10: }
                     11: if (PHP_INT_SIZE != 4) {
                     12:   die("skip this test is for 32bit platform only");
                     13: }
                     14: ?>
                     15: --FILE--
                     16: <?php
                     17: /* Prototype: bool symlink ( string $target, string $link );
                     18:    Description: creates a symbolic link to the existing target with the specified name link
                     19: 
                     20:    Prototype: bool is_link ( string $filename );
                     21:    Description: Tells whether the given file is a symbolic link.
                     22: 
                     23:    Prototype: bool link ( string $target, string $link );
                     24:    Description: Create a hard link
                     25: 
                     26:    Prototype: int linkinfo ( string $path );
                     27:    Description: Gets information about a link
                     28: */
                     29: 
                     30: // create temp $filename and create link $linkname to it
                     31: $filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp";
                     32: $fp = fopen($filename, "w");  // create temp file
                     33: fclose($fp);
                     34: 
                     35: // linkname used to create soft/hard link
                     36: $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp";
                     37: 
                     38: echo "*** Testing symlink() for error conditions ***\n";
                     39: //zero arguments
                     40: var_dump( symlink() );
                     41: 
                     42: //more than expected
                     43: var_dump( symlink($filename, $linkname, true) );
                     44: 
                     45: //invalid arguments
                     46: var_dump( symlink(NULL, $linkname) );  // NULL as filename
                     47: var_dump( symlink('', $linkname) );  // empty string as filename
                     48: var_dump( symlink(false, $linkname) );  // boolean false as filename
                     49: var_dump( symlink($filename, NULL) );  // NULL as linkname
                     50: var_dump( symlink($filename, '') );  // '' as linkname
                     51: var_dump( symlink($filename, false) );  // false as linkname
                     52: 
                     53: echo "\n*** Testing linkinfo() for error conditions ***\n";
                     54: //zero arguments
                     55: var_dump( linkinfo() );
                     56: 
                     57: //more than expected
                     58: var_dump( linkinfo($linkname, true) );
                     59: 
                     60: //invalid arguments
                     61: var_dump( linkinfo(NULL) );  // NULL as linkname
                     62: var_dump( linkinfo('') );  // empty string as linkname
                     63: var_dump( linkinfo(false) );  // boolean false as linkname
                     64: 
                     65: echo "Done\n";
                     66: ?>
                     67: --CLEAN--
                     68: <?php
                     69: unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp");
                     70: @unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp");
                     71: ?>
                     72: --EXPECTF--
                     73: *** Testing symlink() for error conditions ***
                     74: 
                     75: Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d
                     76: NULL
                     77: 
                     78: Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d
                     79: NULL
                     80: 
                     81: Warning: symlink(): %s in %s on line %d
                     82: bool(false)
                     83: 
                     84: Warning: symlink(): %s in %s on line %d
                     85: bool(false)
                     86: 
                     87: Warning: symlink(): %s in %s on line %d
                     88: bool(false)
                     89: 
                     90: Warning: symlink(): %s in %s on line %d
                     91: bool(false)
                     92: 
                     93: Warning: symlink(): %s in %s on line %d
                     94: bool(false)
                     95: 
                     96: Warning: symlink(): %s in %s on line %d
                     97: bool(false)
                     98: 
                     99: *** Testing linkinfo() for error conditions ***
                    100: 
                    101: Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d
                    102: NULL
                    103: 
                    104: Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d
                    105: NULL
                    106: 
                    107: Warning: linkinfo(): %s in %s on line %d
                    108: int(-1)
                    109: 
                    110: Warning: linkinfo(): %s in %s on line %d
                    111: int(-1)
                    112: 
                    113: Warning: linkinfo(): %s in %s on line %d
                    114: int(-1)
                    115: Done

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