wharmby Mon Jan 12 15:59:04 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard/tests/file readfile_variation10-win32.phpt file_get_contents_variation8-win32.phpt file_put_contents_variation8-win32.phpt Log: Fix Windows tests after #47037
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/readfile_variation10-win32.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/file/readfile_variation10-win32.phpt diff -u php-src/ext/standard/tests/file/readfile_variation10-win32.phpt:1.1.4.2 php-src/ext/standard/tests/file/readfile_variation10-win32.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/readfile_variation10-win32.phpt:1.1.4.2 Wed Nov 26 10:10:16 2008 +++ php-src/ext/standard/tests/file/readfile_variation10-win32.phpt Mon Jan 12 15:59:04 2009 @@ -17,56 +17,71 @@ echo "*** Testing readfile() : variation ***\n"; - /* An array of files */ $names_arr = array( /* Invalid args */ - -1, - TRUE, - FALSE, - NULL, - "", - " ", - "\0", - array(), + "-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 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt diff -u php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt:1.1.4.2 php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt:1.1.4.2 Wed Nov 26 10:10:17 2008 +++ php-src/ext/standard/tests/file/file_get_contents_variation8-win32.phpt Mon Jan 12 15:59:04 2009 @@ -16,64 +16,82 @@ */ 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 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt diff -u php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt:1.1.4.2 php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt:1.1.4.2 Wed Nov 26 10:10:17 2008 +++ php-src/ext/standard/tests/file/file_put_contents_variation8-win32.phpt Mon Jan 12 15:59:04 2009 @@ -19,64 +19,80 @@ /* 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"; - } -} +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"; + } +}; -echo "\n*** Done ***\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
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php