summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2011-09-01 00:45:56 +0000
committerMatteo Beccati <mbeccati@php.net>2011-09-01 00:45:56 +0000
commitdff6510fc51a69ebb34db57225245c611588e3cf (patch)
tree9286b47426b6013576739bdedf1d692d8e21ad9a
parentc2ca9678fa52c219dbab69b96fb32fc99f0559dd (diff)
downloadphp-git-dff6510fc51a69ebb34db57225245c611588e3cf.tar.gz
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
-rw-r--r--ext/curl/tests/curl_error_basic.phpt18
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/curl/tests/curl_error_basic.phpt b/ext/curl/tests/curl_error_basic.phpt
index c9aa9ef8a0..bd01847f00 100644
--- a/ext/curl/tests/curl_error_basic.phpt
+++ b/ext/curl/tests/curl_error_basic.phpt
@@ -4,7 +4,15 @@ curl_error() function - basic test for curl_error using a fake url
Mattijs Hoitink mattijshoitink@gmail.com
#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 @@ echo "== Testing curl_error with a fake URL ==\n";
// 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"