Annotation of embedaddon/php/ext/standard/tests/file/is_file_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test is_file() function: usage variations - links
! 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) == 'WIN') {
! 6: die('skip Do not run on Windows');
! 7: }
! 8: --FILE--
! 9: <?php
! 10: /* Prototype: bool is_file ( string $filename );
! 11: Description: Tells whether the filename is a regular file
! 12: Returns TRUE if the filename exists and is a regular file
! 13: */
! 14:
! 15: /* Creating soft and hard links to a file and applying is_file() on links */
! 16:
! 17: $file_path = dirname(__FILE__);
! 18: fclose( fopen($file_path."/is_file_variation2.tmp", "w") );
! 19:
! 20: echo "*** Testing is_file() with links ***\n";
! 21: /* With symlink */
! 22: symlink($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_symlink.tmp");
! 23: var_dump( is_file($file_path."/is_file_variation2_symlink.tmp") ); //expected true
! 24: clearstatcache();
! 25:
! 26: /* With hardlink */
! 27: link($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_link.tmp");
! 28: var_dump( is_file($file_path."/is_file_variation2_link.tmp") ); // expected: true
! 29: clearstatcache();
! 30:
! 31: echo "\n*** Done ***";
! 32: ?>
! 33: --CLEAN--
! 34: <?php
! 35: $file_path = dirname(__FILE__);
! 36: unlink($file_path."/is_file_variation2_symlink.tmp");
! 37: unlink($file_path."/is_file_variation2_link.tmp");
! 38: unlink($file_path."/is_file_variation2.tmp");
! 39: ?>
! 40:
! 41: --EXPECTF--
! 42: *** Testing is_file() with links ***
! 43: bool(true)
! 44: bool(true)
! 45:
! 46: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>