Return to filegroup_variation2.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test filegroup() function: usage variations - invalid filenames 3: --CREDITS-- 4: Dave Kelsey <d_kelsey@uk.ibm.com> 5: --FILE-- 6: <?php 7: /* Prototype: int filegroup ( string $filename ) 8: * Description: Returns the group ID of the file, or FALSE in case of an error. 9: */ 10: 11: /* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */ 12: 13: $file_path = dirname(__FILE__); 14: $file_handle = fopen($file_path."/filegroup_variation2.tmp", "w"); 15: 16: echo "*** Testing Invalid file types ***\n"; 17: $filenames = array( 18: /* Invalid filenames */ 19: -2.34555, 20: " ", 21: "", 22: TRUE, 23: FALSE, 24: NULL, 25: $file_handle, 26: 27: /* scalars */ 28: 1234, 29: 0 30: ); 31: 32: /* loop through to test each element the above array */ 33: foreach( $filenames as $filename ) { 34: var_dump( filegroup($filename) ); 35: clearstatcache(); 36: } 37: fclose($file_handle); 38: 39: echo "\n*** Done ***"; 40: ?> 41: --CLEAN-- 42: <?php 43: $file_path = dirname(__FILE__); 44: unlink($file_path."/filegroup_variation2.tmp"); 45: ?> 46: --EXPECTF-- 47: *** Testing Invalid file types *** 48: 49: Warning: filegroup(): stat failed for -2.34555 in %s on line %d 50: bool(false) 51: 52: Warning: filegroup(): stat failed for in %s on line %d 53: bool(false) 54: bool(false) 55: 56: Warning: filegroup(): stat failed for 1 in %s on line %d 57: bool(false) 58: bool(false) 59: bool(false) 60: 61: Warning: filegroup() expects parameter 1 to be string, resource given in %s on line %d 62: NULL 63: 64: Warning: filegroup(): stat failed for 1234 in %s on line %d 65: bool(false) 66: 67: Warning: filegroup(): stat failed for 0 in %s on line %d 68: bool(false) 69: 70: *** Done *** 71: