jani Sat, 25 Jul 2009 22:20:18 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286329
Log: - Fix tests to be more comptatible AND to test what they are supposed to test Changed paths: U php/php-src/branches/PHP_5_2/ext/curl/tests/curl_CURLOPT_READDATA.phpt U php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_006.phpt U php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_007.phpt U php/php-src/branches/PHP_5_2/ext/curl/tests/curl_setopt_basic002.phpt U php/php-src/branches/PHP_5_3/ext/curl/tests/curl_CURLOPT_READDATA.phpt U php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_006.phpt U php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_007.phpt U php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt U php/php-src/trunk/ext/curl/tests/curl_CURLOPT_READDATA.phpt U php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_006.phpt U php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_007.phpt U php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt
Modified: php/php-src/branches/PHP_5_2/ext/curl/tests/curl_CURLOPT_READDATA.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_2/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -33,7 +33,7 @@ curl_close($ch); // Clean the temporary file -unset($tempname); +...@unlink($tempname); --EXPECT-- array(2) { Modified: php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_006.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -21,15 +21,17 @@ curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); - curl_close($ch); - - $curl_content = curl_exec($copy); + + var_dump( curl_exec($ch) ); + var_dump( curl_exec($copy) ); + + curl_close($ch); // can not close original handle before curl_exec($copy) since it causes char * inputs to be invalid (see also: http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html) curl_close($copy); - var_dump( $curl_content ); ?> ===DONE=== --EXPECTF-- *** Testing curl copy handle with User Agent *** string(9) "cURL phpt" -===DONE=== \ No newline at end of file +string(9) "cURL phpt" +===DONE=== Modified: php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_007.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_2/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -15,6 +15,7 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array("Hello" => "World", "Foo" => "Bar", "Person" => "John Doe")); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // Disable Expect: header (lighttpd does not support it :) curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); Modified: php/php-src/branches/PHP_5_2/ext/curl/tests/curl_setopt_basic002.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_2/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -13,7 +13,8 @@ // start testing echo "*** Testing curl_setopt with CURLOPT_STDERR\n"; -$temp_file = tempnam(sys_get_temp_dir(), ''); +$temp_file = tempnam(sys_get_temp_dir(), 'CURL_STDERR'); + $handle = fopen($temp_file, 'w'); $url = "{$host}/"; @@ -21,31 +22,29 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); - $curl_content = curl_exec($ch); + fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); +...@unlink($temp_file); -var_dump( curl_error($ch) ); -var_dump( file_get_contents($temp_file)); - -...@unlink ($temp_file); -$handle = fopen($temp_file, 'w'); - ob_start(); // start output buffering -curl_setopt($ch, CURLOPT_VERBOSE, 1); -curl_setopt($ch, CURLOPT_STDERR, $handle); +$handle = fopen($temp_file, 'w'); curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use - +curl_setopt($ch, CURLOPT_STDERR, $handle); $data = curl_exec($ch); -fclose($handle); ob_end_clean(); -var_dump(file_get_contents($temp_file)); -curl_close($ch); +fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); @unlink($temp_file); + +curl_close($ch); + ?> --EXPECTF-- *** Testing curl_setopt with CURLOPT_STDERR -string(%d) "%s%w" string(%d) "%S" string(%d) "%S" Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_CURLOPT_READDATA.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -33,7 +33,7 @@ curl_close($ch); // Clean the temporary file -unset($tempname); +...@unlink($tempname); --EXPECT-- array(2) { Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_006.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -21,15 +21,17 @@ curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); - curl_close($ch); - - $curl_content = curl_exec($copy); + + var_dump( curl_exec($ch) ); + var_dump( curl_exec($copy) ); + + curl_close($ch); // can not close original handle before curl_exec($copy) since it causes char * inputs to be invalid (see also: http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html) curl_close($copy); - var_dump( $curl_content ); ?> ===DONE=== --EXPECTF-- *** Testing curl copy handle with User Agent *** string(9) "cURL phpt" -===DONE=== \ No newline at end of file +string(9) "cURL phpt" +===DONE=== Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_007.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -15,6 +15,7 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array("Hello" => "World", "Foo" => "Bar", "Person" => "John Doe")); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // Disable Expect: header (lighttpd does not support it :) curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -13,7 +13,8 @@ // start testing echo "*** Testing curl_setopt with CURLOPT_STDERR\n"; -$temp_file = tempnam(sys_get_temp_dir(), ''); +$temp_file = tempnam(sys_get_temp_dir(), 'CURL_STDERR'); + $handle = fopen($temp_file, 'w'); $url = "{$host}/"; @@ -21,31 +22,29 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); - $curl_content = curl_exec($ch); + fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); +...@unlink($temp_file); -var_dump( curl_error($ch) ); -var_dump( file_get_contents($temp_file)); - -...@unlink ($temp_file); -$handle = fopen($temp_file, 'w'); - ob_start(); // start output buffering -curl_setopt($ch, CURLOPT_VERBOSE, 1); -curl_setopt($ch, CURLOPT_STDERR, $handle); +$handle = fopen($temp_file, 'w'); curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use - +curl_setopt($ch, CURLOPT_STDERR, $handle); $data = curl_exec($ch); -fclose($handle); ob_end_clean(); -var_dump(file_get_contents($temp_file)); -curl_close($ch); +fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); @unlink($temp_file); + +curl_close($ch); + ?> --EXPECTF-- *** Testing curl_setopt with CURLOPT_STDERR -string(%d) "%s%w" string(%d) "%S" string(%d) "%S" Modified: php/php-src/trunk/ext/curl/tests/curl_CURLOPT_READDATA.phpt =================================================================== --- php/php-src/trunk/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/trunk/ext/curl/tests/curl_CURLOPT_READDATA.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -33,7 +33,7 @@ curl_close($ch); // Clean the temporary file -unset($tempname); +...@unlink($tempname); --EXPECT-- array(2) { Modified: php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_006.phpt =================================================================== --- php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_006.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -21,15 +21,17 @@ curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); - curl_close($ch); - - $curl_content = curl_exec($copy); + + var_dump( curl_exec($ch) ); + var_dump( curl_exec($copy) ); + + curl_close($ch); // can not close original handle before curl_exec($copy) since it causes char * inputs to be invalid (see also: http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html) curl_close($copy); - var_dump( $curl_content ); ?> ===DONE=== --EXPECTF-- *** Testing curl copy handle with User Agent *** string(9) "cURL phpt" -===DONE=== \ No newline at end of file +string(9) "cURL phpt" +===DONE=== Modified: php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_007.phpt =================================================================== --- php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_007.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -15,6 +15,7 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array("Hello" => "World", "Foo" => "Bar", "Person" => "John Doe")); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // Disable Expect: header (lighttpd does not support it :) curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use $copy = curl_copy_handle($ch); Modified: php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt =================================================================== --- php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 21:56:31 UTC (rev 286328) +++ php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt 2009-07-25 22:20:18 UTC (rev 286329) @@ -13,7 +13,8 @@ // start testing echo "*** Testing curl_setopt with CURLOPT_STDERR\n"; -$temp_file = tempnam(sys_get_temp_dir(), ''); +$temp_file = tempnam(sys_get_temp_dir(), 'CURL_STDERR'); + $handle = fopen($temp_file, 'w'); $url = "{$host}/"; @@ -21,31 +22,29 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); - $curl_content = curl_exec($ch); + fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); +...@unlink($temp_file); -var_dump( curl_error($ch) ); -var_dump( file_get_contents($temp_file)); - -...@unlink ($temp_file); -$handle = fopen($temp_file, 'w'); - ob_start(); // start output buffering -curl_setopt($ch, CURLOPT_VERBOSE, 1); -curl_setopt($ch, CURLOPT_STDERR, $handle); +$handle = fopen($temp_file, 'w'); curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use - +curl_setopt($ch, CURLOPT_STDERR, $handle); $data = curl_exec($ch); -fclose($handle); ob_end_clean(); -var_dump(file_get_contents($temp_file)); -curl_close($ch); +fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); @unlink($temp_file); + +curl_close($ch); + ?> --EXPECTF-- *** Testing curl_setopt with CURLOPT_STDERR -string(%d) "%s%w" string(%d) "%S" string(%d) "%S"
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php