Create post-HADVAs expect files
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / file / unlink_basic.php
blob50e6d84bed00b50e48b30addcb3614609d523554
1 <?hh
2 /* Prototype : bool unlink ( string $filename [, resource $context] );
3 Description : Deletes filename
4 */
5 <<__EntryPoint>> function main(): void {
7 echo "*** Testing unlink() on a file ***\n";
8 $filename = __SystemLib\hphp_test_tmppath('unlink_basic.tmp'); // temp file name used here
9 $fp = fopen($filename, "w"); // create file
10 fwrite($fp, "Hello World");
11 fclose($fp);
13 // delete file
14 var_dump( unlink($filename) );
15 var_dump( file_exists($filename) ); // confirm file doesnt exist
17 echo "\n*** Testing unlink() : checking second argument ***\n";
18 // creating a context
19 $context = stream_context_create();
20 // temp file name used here
21 $filename = __SystemLib\hphp_test_tmppath('unlink_basic.tmp');
22 $fp = fopen($filename, "w"); // create file
23 fclose($fp);
25 // delete file
26 var_dump( unlink($filename, $context) ); // using $context in second argument
27 var_dump( file_exists($filename) ); // confirm file doesnt exist
29 echo "Done\n";