Annotation of embedaddon/php/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test symlink(), linkinfo(), link() and is_link() functions : usage variations - hardlink to non-existent file
! 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) == 'WIN') {
! 6: die('skip no symlinks on Windows');
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: /* Prototype: bool symlink ( string $target, string $link );
! 12: Description: creates a symbolic link to the existing target with the specified name link
! 13:
! 14: Prototype: bool is_link ( string $filename );
! 15: Description: Tells whether the given file is a symbolic link.
! 16:
! 17: Prototype: bool link ( string $target, string $link );
! 18: Description: Create a hard link
! 19:
! 20: Prototype: int linkinfo ( string $path );
! 21: Description: Gets information about a link
! 22: */
! 23:
! 24: /* Variation 2 : Create hard link to non-existent file */
! 25:
! 26: $file_path = dirname(__FILE__);
! 27: // non-existing filename
! 28: $non_existent_file = "$file_path/non_existent_file_variation2.tmp";
! 29: // non-existing linkname
! 30: $non_existent_linkname = "$file_path/non_existent_linkname_variation2.tmp";
! 31:
! 32: echo "*** Creating a hard link to a non-existent file ***\n";
! 33: // creating hard link to non_existent file
! 34: var_dump( link($non_existent_file, $non_existent_linkname) ); // expected false
! 35:
! 36: // checking linkinfo() and is_link() on the link; expected: false
! 37: var_dump( linkinfo($non_existent_linkname) );
! 38: var_dump( is_link($non_existent_linkname) );
! 39:
! 40: echo "Done\n";
! 41: ?>
! 42: --EXPECTF--
! 43: *** Creating a hard link to a non-existent file ***
! 44:
! 45: Warning: link(): No such file or directory in %s on line %d
! 46: bool(false)
! 47:
! 48: Warning: linkinfo(): No such file or directory in %s on line %d
! 49: int(-1)
! 50: bool(false)
! 51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>