Annotation of embedaddon/php/ext/standard/tests/file/unlink_variation4.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test unlink() function : usage variations - unlink deleted file
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : bool unlink ( string $filename [, resource $context] );
! 6: Description : Deletes filename
! 7: */
! 8:
! 9: /* Try deleting a file which is already deleted */
! 10:
! 11: $file_path = dirname(__FILE__);
! 12:
! 13: // temp file used
! 14: $filename = "$file_path/unlink_variation4.tmp";
! 15:
! 16: echo "*** Testing unlink() on deleted file ***\n";
! 17: // create temp file
! 18: $fp = fopen($filename, "w");
! 19: fclose($fp);
! 20:
! 21: // delete temp file
! 22: var_dump( unlink($filename) ); // expected: true
! 23: var_dump( file_exists($filename) ); // confirm file deleted
! 24:
! 25: // delete deleted file
! 26: var_dump( unlink($filename) ); // expected: false
! 27:
! 28: echo "Done\n";
! 29: ?>
! 30: --EXPECTF--
! 31: *** Testing unlink() on deleted file ***
! 32: bool(true)
! 33: bool(false)
! 34:
! 35: Warning: unlink(%s/unlink_variation4.tmp): %s in %s on line %d
! 36: bool(false)
! 37: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>