From: Jani Taskinen Date: Sat, 25 Jul 2009 22:20:18 +0000 (+0000) Subject: - Fix tests to be more comptatible AND to test what they are supposed to test X-Git-Tag: php-5.2.11RC1~96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4abb6878fd5714f514f218f8788567bc9c3f389a;p=php - Fix tests to be more comptatible AND to test what they are supposed to test --- diff --git a/ext/curl/tests/curl_CURLOPT_READDATA.phpt b/ext/curl/tests/curl_CURLOPT_READDATA.phpt index e32c59230a..00f3ea95ab 100644 --- a/ext/curl/tests/curl_CURLOPT_READDATA.phpt +++ b/ext/curl/tests/curl_CURLOPT_READDATA.phpt @@ -33,7 +33,7 @@ if (false === $response = curl_exec($ch)) { curl_close($ch); // Clean the temporary file -unset($tempname); +@unlink($tempname); --EXPECT-- array(2) { diff --git a/ext/curl/tests/curl_copy_handle_basic_006.phpt b/ext/curl/tests/curl_copy_handle_basic_006.phpt index 3026da81e0..d2374c7213 100644 --- a/ext/curl/tests/curl_copy_handle_basic_006.phpt +++ b/ext/curl/tests/curl_copy_handle_basic_006.phpt @@ -21,15 +21,17 @@ Rick Buitenman 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=== diff --git a/ext/curl/tests/curl_copy_handle_basic_007.phpt b/ext/curl/tests/curl_copy_handle_basic_007.phpt index 5be9048af6..a51d9f6dfa 100644 --- a/ext/curl/tests/curl_copy_handle_basic_007.phpt +++ b/ext/curl/tests/curl_copy_handle_basic_007.phpt @@ -15,6 +15,7 @@ Test curl_copy_handle() with simple POST 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); diff --git a/ext/curl/tests/curl_setopt_basic002.phpt b/ext/curl/tests/curl_setopt_basic002.phpt index d60c5d04d7..051703fb08 100644 --- a/ext/curl/tests/curl_setopt_basic002.phpt +++ b/ext/curl/tests/curl_setopt_basic002.phpt @@ -13,7 +13,8 @@ $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER'); // 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 @@ $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); - $curl_content = curl_exec($ch); -fclose($handle); -var_dump( curl_error($ch) ); -var_dump( file_get_contents($temp_file)); - -@unlink ($temp_file); -$handle = fopen($temp_file, 'w'); +fclose($handle); +unset($handle); +var_dump( file_get_contents($temp_file) ); +@unlink($temp_file); 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"