mbeccati Thu, 01 Sep 2011 00:45:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=315940
Log:
Fixed test randomly failing due to different error messages. Also added a skip
section in case "fakeURL" resolves to an IP address, as some empty error
messages and HTML can be seen in the reports
Changed paths:
U php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
U php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
U php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt
Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
2011-08-31 23:42:04 UTC (rev 315939)
+++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
2011-09-01 00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
Mattijs Hoitink [email protected]
#Testfest Utrecht 2009
--SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip"; ?>
+<?php
+
+if (!extension_loaded("curl")) die("skip\n");
+
+$url = "fakeURL";
+$ip = gethostbyname($url);
+if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
+
+?>
--FILE--
<?php
/*
@@ -21,13 +29,13 @@
// cURL handler
$ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-ob_start(); // start output buffering
curl_exec($ch);
-echo "Error: " . curl_error($ch);
+var_dump(curl_error($ch));
curl_close($ch);
?>
---EXPECT--
+--EXPECTF--
== Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) "%sfakeURL%s"
Modified: php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
2011-08-31 23:42:04 UTC (rev 315939)
+++ php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
2011-09-01 00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
Mattijs Hoitink [email protected]
#Testfest Utrecht 2009
--SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip"; ?>
+<?php
+
+if (!extension_loaded("curl")) die("skip\n");
+
+$url = "fakeURL";
+$ip = gethostbyname($url);
+if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
+
+?>
--FILE--
<?php
/*
@@ -21,13 +29,13 @@
// cURL handler
$ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-ob_start(); // start output buffering
curl_exec($ch);
-echo "Error: " . curl_error($ch);
+var_dump(curl_error($ch));
curl_close($ch);
?>
---EXPECT--
+--EXPECTF--
== Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) "%sfakeURL%s"
Modified: php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt
===================================================================
--- php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt 2011-08-31
23:42:04 UTC (rev 315939)
+++ php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt 2011-09-01
00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
Mattijs Hoitink [email protected]
#Testfest Utrecht 2009
--SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip"; ?>
+<?php
+
+if (!extension_loaded("curl")) die("skip\n");
+
+$url = "fakeURL";
+$ip = gethostbyname($url);
+if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
+
+?>
--FILE--
<?php
/*
@@ -21,13 +29,13 @@
// cURL handler
$ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-ob_start(); // start output buffering
curl_exec($ch);
-echo "Error: " . curl_error($ch);
+var_dump(curl_error($ch));
curl_close($ch);
?>
---EXPECT--
+--EXPECTF--
== Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) "%sfakeURL%s"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php