]> granicus.if.org Git - php/commitdiff
Fix Windows tests after #47037
authorandy wharmby <wharmby@php.net>
Mon, 12 Jan 2009 15:59:20 +0000 (15:59 +0000)
committerandy wharmby <wharmby@php.net>
Mon, 12 Jan 2009 15:59:20 +0000 (15:59 +0000)
ext/standard/tests/file/007_error.phpt
ext/standard/tests/file/file_get_contents_variation8-win32.phpt
ext/standard/tests/file/file_put_contents_variation8-win32.phpt
ext/standard/tests/file/readfile_variation10-win32.phpt

index d11fa502035de2ed0bbba36db1ddc0f564ac5e61..82cf7278f92a779fd47fb4c0d3fc41b932aa5c94 100644 (file)
@@ -65,6 +65,7 @@ for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
 }
 
 ?>
+===Done===
 --EXPECTF--
 *** Testing error conditions for fopen(), fclsoe() & feof() ***
 
@@ -74,7 +75,7 @@ bool(false)
 Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
 bool(false)
 
-Warning: fclose(): 5 is not a valid stream resource in %s on line %d
+Warning: fclose(): %d is not a valid stream resource in %s on line %d
 bool(false)
 
 Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d
@@ -83,7 +84,7 @@ bool(false)
 Warning: Wrong parameter count for fclose() in %s on line %d
 NULL
 
-Warning: feof(): 5 is not a valid stream resource in %s on line %d
+Warning: feof(): %d is not a valid stream resource in %s on line %d
 bool(false)
 
 Warning: feof(): supplied argument is not a valid stream resource in %s on line %d
@@ -181,3 +182,4 @@ bool(false)
 
 Warning: feof(): supplied argument is not a valid stream resource in %s on line %d
 bool(false)
+===Done===
\ No newline at end of file
index 4e67a334529e3b8285ec5a08b6882a49e82c4c56..8598f4335f67a63588982adb438edfebfd91a59e 100644 (file)
@@ -16,64 +16,82 @@ if(substr(PHP_OS, 0, 3) != "WIN")
  */
 
 echo "*** Testing file_get_contents() : variation ***\n";
+
 /* An array of filenames */ 
 $names_arr = array(
-  /* Invalid args */ 
-  -1,
-  TRUE,
-  FALSE,
-  NULL,
-  "",
-  " ",
-  "\0",
-  array(),
-
-  /* prefix with path separator of a non existing directory*/
-  "/no/such/file/dir", 
-  "php/php"
+  /* Invalid args */  
+  "-1" => -1,
+  "TRUE" => TRUE,
+  "FALSE" => FALSE,
+  "NULL" => NULL,
+  "\"\"" => "",
+  "\" \"" => " ",
+  "\\0" => "\0",
+  "array()" => array(),
+
+  /* prefix with path separator of a non existing directory*/ 
+  "/no/such/file/dir" => "/no/such/file/dir"
+  "php/php"=> "php/php"
 
 );
 
-for( $i=0; $i<count($names_arr); $i++ ) {
-  echo "-- Iteration $i --\n";
-  var_dump(file_get_contents($names_arr[$i]));
+foreach($names_arr as $key =>$value) {
+  echo "\n-- Filename: $key --\n";
+  var_dump(file_get_contents($value));
 }
 
-echo "\n*** Done ***\n";
 ?>
+===Done===
 --EXPECTF--
 *** Testing file_get_contents() : variation ***
--- Iteration 0 --
+
+-- Filename: -1 --
 
 Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
 bool(false)
--- Iteration 1 --
+
+-- Filename: TRUE --
 
 Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
 bool(false)
--- Iteration 2 --
+
+-- Filename: FALSE --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
 bool(false)
--- Iteration 3 --
+
+-- Filename: NULL --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
 bool(false)
--- Iteration 4 --
+
+-- Filename: "" --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
 bool(false)
--- Iteration 5 --
+
+-- Filename: " " --
 
 Warning: file_get_contents( ): failed to open stream: Permission denied in %s on line %d
 bool(false)
--- Iteration 6 --
+
+-- Filename: \0 --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
 bool(false)
--- Iteration 7 --
+
+-- Filename: array() --
 
 Warning: file_get_contents() expects parameter 1 to be string, array given in %s on line %d
 NULL
--- Iteration 8 --
+
+-- Filename: /no/such/file/dir --
 
 Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
 bool(false)
--- Iteration 9 --
+
+-- Filename: php/php --
 
 Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
 bool(false)
-
-*** Done ***
\ No newline at end of file
+===Done===
\ No newline at end of file
index ce06019e8654e412abbdf466e1acfe1583bde5d5..1609b10e122fdff25bc3f903cee1797c8636274c 100644 (file)
@@ -19,64 +19,80 @@ echo "*** Testing file_put_contents() : usage variation ***\n";
 
 /* An array of filenames */ 
 $names_arr = array(
-  -1,
-  TRUE,
-  FALSE,
-  NULL,
-  "",
-  " ",
-  "\0",
-  array(),
-
-  //the next 2 generate java messages so we don't replicate the php messages
-  "/no/such/file/dir", 
-  "php/php"
+  "-1" => -1,
+  "TRUE" => TRUE,
+  "FALSE" => FALSE,
+  "NULL" => NULL,
+  "\"\"" => "",
+  "\" \"" => " ",
+  "\\0" => "\0",
+  "array()" => array(),
+
+  /* prefix with path separator of a non existing directory*/ 
+  "/no/such/file/dir" => "/no/such/file/dir"
+  "php/php"=> "php/php"
 
 );
 
-for( $i=0; $i<count($names_arr); $i++ ) {
-  echo "-- Iteration $i --\n";
-  $res = file_put_contents($names_arr[$i], "Some data");
-  if ($res !== false && $res != null) {
-     echo "$res bytes written to: $names_arr[$i]\n";
-     unlink($names_arr[$i]);
-  }
-  else {
-     echo "Failed to write data to: $names_arr[$i]\n";
-  }
-}
-
-echo "\n*** Done ***\n";
+foreach($names_arr as $key =>$value) {
+      echo "\n-- Filename: $key --\n";
+      $res = file_put_contents($value, "Some data");
+         if ($res !== false && $res != null) {
+        echo "$res bytes written to: $value\n";
+        unlink($value);
+         } else {
+         echo "Failed to write data to: $key\n";
+      }        
+};
+
 ?>
+===Done===
 --EXPECTF--
 *** Testing file_put_contents() : usage variation ***
--- Iteration 0 --
+
+-- Filename: -1 --
 9 bytes written to: -1
--- Iteration 1 --
+
+-- Filename: TRUE --
 9 bytes written to: 1
--- Iteration 2 --
-Failed to write data to: 
--- Iteration 3 --
-Failed to write data to: 
--- Iteration 4 --
-Failed to write data to: 
--- Iteration 5 --
+
+-- Filename: FALSE --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: FALSE
+
+-- Filename: NULL --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: NULL
+
+-- Filename: "" --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: ""
+
+-- Filename: " " --
 
 Warning: file_put_contents( ): failed to open stream: Permission denied in %s on line %d
-Failed to write data to:  
--- Iteration 6 --
-Failed to write data to:%s
--- Iteration 7 --
+Failed to write data to: " "
+
+-- Filename: \0 --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: \0
+
+-- Filename: array() --
 
 Warning: file_put_contents() expects parameter 1 to be string, array given in %s on line %d
-Failed to write data to: Array
--- Iteration 8 --
+Failed to write data to: array()
+
+-- Filename: /no/such/file/dir --
 
 Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d
 Failed to write data to: /no/such/file/dir
--- Iteration 9 --
+
+-- Filename: php/php --
 
 Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d
 Failed to write data to: php/php
-
-*** Done ***
\ No newline at end of file
+===Done===
\ No newline at end of file
index 6fa905ac0ba3b25b3d1c727e23c2bbcd9f75bff0..d4cad6c1e83dd9aca10881d43951d4b503501673 100644 (file)
@@ -17,56 +17,71 @@ if(substr(PHP_OS, 0, 3) != "WIN")
 
 echo "*** Testing readfile() : variation ***\n";
 
-
 /* An array of files */ 
 $names_arr = array(
-  /* Invalid args */ 
-  -1,
-  TRUE,
-  FALSE,
-  NULL,
-  "",
-  " ",
-  "\0",
-  array(),
+  /* Invalid args */
+  "-1" => -1,
+  "TRUE" => TRUE,
+  "FALSE" => FALSE,
+  "NULL" => NULL,
+  "\"\"" => "",
+  "\" \"" => " ",
+  "\\0" => "\0",
+  "array()" => array(),
 
   /* prefix with path separator of a non existing directory*/
-  "/no/such/file/dir", 
-  "php/php"
+  "/no/such/file/dir" => "/no/such/file/dir"
+  "php/php"=> "php/php"
 
 );
 
-for( $i=0; $i<count($names_arr); $i++ ) {
-  $name = $names_arr[$i];
-  echo "-- testing '$name' --\n";  
-  readfile($name);
-}
+foreach($names_arr as $key => $value) {
+      echo "\n-- Filename: $key --\n";
+      readfile($value);
+};
 
-echo "\n*** Done ***\n";
 ?>
+===Done===
 --EXPECTF--
 *** Testing readfile() : variation ***
--- testing '-1' --
+
+-- Filename: -1 --
 
 Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d
--- testing '1' --
+
+-- Filename: TRUE --
 
 Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
--- testing '' --
--- testing '' --
--- testing '' --
--- testing ' ' --
+
+-- Filename: FALSE --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: NULL --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: "" --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: " " --
 
 Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
--- testing '%s' --
--- testing 'Array' --
+
+-- Filename: \0 --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: array() --
 
 Warning: readfile() expects parameter 1 to be string, array given in %s on line %d
--- testing '/no/such/file/dir' --
+
+-- Filename: /no/such/file/dir --
 
 Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
--- testing 'php/php' --
 
-Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
+-- Filename: php/php --
 
-*** Done ***
\ No newline at end of file
+Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
+===Done===
\ No newline at end of file