From: andy wharmby Date: Mon, 12 Jan 2009 15:59:20 +0000 (+0000) Subject: Fix Windows tests after #47037 X-Git-Tag: php-5.2.9RC1~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2e013662d76d812bbc2aa7a3e4a019bc2ee8f53;p=php Fix Windows tests after #47037 --- diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt index d11fa50203..82cf7278f9 100644 --- a/ext/standard/tests/file/007_error.phpt +++ b/ext/standard/tests/file/007_error.phpt @@ -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 diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index 4e67a33452..8598f4335f 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -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$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 diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index ce06019e86..1609b10e12 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -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$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 diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index 6fa905ac0b..d4cad6c1e8 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -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 $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