]> granicus.if.org Git - php/commitdiff
- MFB:
authorPierre Joye <pajoye@php.net>
Sun, 17 Aug 2008 11:10:52 +0000 (11:10 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 17 Aug 2008 11:10:52 +0000 (11:10 +0000)
 - fix or improve tests
 - add dump of the array_diff for compare_stats

ext/standard/tests/file/file.inc
ext/standard/tests/file/stat_basic-win32.phpt
ext/standard/tests/file/stat_variation8-win32.phpt
ext/standard/tests/file/tempnam_variation3-win32.phpt
ext/standard/tests/file/touch.phpt

index 57143088600c18ca4e376d117af4d579ebac816b..4a52b1d51d8beab3b6fbb9529e7922190868dd66 100644 (file)
@@ -279,7 +279,7 @@ function create_files( $file_path,
   if ( $content_type == "empty" ) {
     $return_value['filled'] = $count;
   } else {
-    //fill the file with specifiec type of data and size
+    // fill the file with specifiec type of data and size
     $tmp_name_suffix = $name_suffix;
     for($loop_counter = 1; $loop_counter <= $count; $loop_counter ++) {
       $filename = $file_path."/".$name_prefix.$tmp_name_suffix.$file_extension;
@@ -577,7 +577,7 @@ Description:
   $stat2 = second stat array
   $op = type of the comparision to be perform between elements of stat1 and stat2
     "!=" compare for not equal
-    "==" comprae for equality
+    "==" compare for equality
     ">"  if each element of stat1 is > than stat2
     "<"  if each element of stat1 is < than stat2
   $fields = contains the key of the elements that needs to be compared. 
@@ -585,7 +585,10 @@ Description:
   $flag = specify true to dump the stat1 and stat2 
 */
 
-$all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks");
+$all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+                       "dev", "ino", "mode", "nlink", "uid", "gid",
+                       "rdev", "size", "atime", "mtime", "ctime",
+                       "blksize", "blocks");
 
 function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
   // dump the stat if requested
@@ -635,6 +638,8 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
   // if the result is false(i.e values are not as expected),
   // dump the stat array so that easy to figure out the error
   if ( $result == false ) {
+    echo "\n Dumping diff between stat array 1 and 2...\n";
+    var_dump(array_diff($stat1, $stat2));
     echo "\n Dumping stat array 1...\n";
     var_dump($stat1);
     echo "\n Dumping stat array 2...\n";
index 62c22ca6c9b2657dce5687daf2c57e84b734440b..680c9b779171ca40a7951c909e77ac1101a43bd1 100644 (file)
@@ -80,15 +80,15 @@ array(26) {
   [0]=>
   int(%d)
   [1]=>
-  int(%d)
+  int(0)
   [2]=>
   int(%d)
   [3]=>
   int(%d)
   [4]=>
-  int(%d)
+  int(0)
   [5]=>
-  int(%d)
+  int(0)
   [6]=>
   int(%d)
   [7]=>
@@ -106,15 +106,15 @@ array(26) {
   [u"dev"]=>
   int(%d)
   [u"ino"]=>
-  int(%d)
+  int(0)
   [u"mode"]=>
   int(%d)
   [u"nlink"]=>
   int(%d)
   [u"uid"]=>
-  int(%d)
+  int(0)
   [u"gid"]=>
-  int(%d)
+  int(0)
   [u"rdev"]=>
   int(%d)
   [u"size"]=>
index 40c86b7ba6afd8d44b166a2103269f606b80ee9c..48e09ec71ae1e8283efb01420d2aee998e8449d7 100644 (file)
@@ -34,7 +34,7 @@ echo "\n*** Testing stat(): on file by truncating it to given size ***\n";
 $file_handle = fopen($filename, "w");
 fclose($file_handle);
 
-clearstatcache();
+clearstatcache(true, $filename);
 $old_stat = stat($filename);
 // clear the cache
 sleep(2);
@@ -44,7 +44,7 @@ $file_handle = fopen($filename, "r+");
 var_dump( ftruncate($file_handle, 512) );  // truncate it
 fclose($file_handle);
 
-clearstatcache();
+clearstatcache(true, $filename);
 $new_stat = stat($filename);
 
 // compare self stats
@@ -56,7 +56,7 @@ $affected_members = array(7, 8, 9, 'size', 'atime', 'mtime');
 var_dump( compare_stats($old_stat, $new_stat, $affected_members, '!=') );
 
 // clear the stat
-clearstatcache();  // clear previous size value in cache
+clearstatcache(true, $filename);  // clear previous size value in cache
 
 echo "\n*** Done ***";
 ?>
index 9dab92271209c12c01ad67c7a00684473c92a218..4e9eb76b5ce368698258c5308b6cf49c2921efcd 100644 (file)
@@ -78,9 +78,10 @@ File name is => %s
 File permissions are => 100666
 -- Iteration 7 --
 
-Notice: Array to string conversion in %s on line %d
-File name is => %s
-File permissions are => 100666
+Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d
+-- File is not created --
+
+Warning: unlink(): %s in %s on line %d
 -- Iteration 8 --
 File name is => %s
 File permissions are => 100666
index ec2215cba9d00dba0ad9d3001c63404b34639b8b..f52fff7e2bb4c4d59b98377469c4a5e305de775e 100644 (file)
@@ -42,7 +42,7 @@ int(%i)
 bool(true)
 int(100)
 bool(true)
-int(100)
+int(-100)
 
 Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d
 bool(false)