Create post-HADVAs expect files
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / file / is_file_variation1.php
blob267f717a1b634454523995f2401d431bac39e9e8
1 <?hh
2 /* Prototype: bool is_file ( string $filename );
3 Description: Tells whether the filename is a regular file
4 Returns TRUE if the filename exists and is a regular file
5 */
7 /* Testing is_file() with file containing data, truncating its size
8 and the file created by touch() */
9 <<__EntryPoint>> function main(): void {
11 echo "-- Testing is_file() with file containing data --\n";
12 $filename = __SystemLib\hphp_test_tmppath('is_file_variation1.tmp');
13 $file_handle = fopen($filename, "w" );
14 fwrite( $file_handle, "Hello, world....." ); // exptected true
15 fclose($file_handle);
16 var_dump( is_file($filename) );
17 clearstatcache();
19 echo "\n-- Testing is_file() after truncating filesize to zero bytes --\n";
20 $file_handle = fopen($filename, "r");
21 ftruncate($file_handle, 0);
22 fclose($file_handle);
23 var_dump( is_file($filename) ); // expected true
24 clearstatcache();
25 unlink($filename);
27 echo "\n-- Testing is_file() with an empty file --\n";
28 /* created by fopen() */
29 fclose( fopen($filename, "w") );
30 var_dump( is_file($filename) ); //expected true
31 clearstatcache();
32 unlink($filename);
34 /* created by touch() */
35 touch($filename);
36 var_dump( is_file($filename) ); // expected true
37 clearstatcache();
38 unlink($filename);
40 echo "\n*** Done ***";