summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2009-08-29 19:18:27 +0000
committerAntony Dovgal <tony2001@php.net>2009-08-29 19:18:27 +0000
commit3a080e82f5f9823c90679c2fdf89c2013a044d69 (patch)
tree6bf4903bf79c06ecc44aa59d867a6784361ceedf
parentacdd739c0bc4c1c678fc5751cce29018a50997cd (diff)
downloadphp-git-3a080e82f5f9823c90679c2fdf89c2013a044d69.tar.gz
fix tests
-rw-r--r--ext/mysql/tests/mysql_affected_rows.phpt5
-rw-r--r--ext/mysql/tests/mysql_insert_id.phpt5
-rwxr-xr-xext/mysql/tests/skipifdefaultconnectfailure.inc11
3 files changed, 17 insertions, 4 deletions
diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt
index 3001bf14ce..ce16a7748c 100644
--- a/ext/mysql/tests/mysql_affected_rows.phpt
+++ b/ext/mysql/tests/mysql_affected_rows.phpt
@@ -4,6 +4,7 @@ mysql_affected_rows()
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
+require_once('skipifdefaultconnectfailure.inc');
?>
--FILE--
<?php
@@ -12,8 +13,8 @@ include_once("connect.inc");
$tmp = NULL;
$link = NULL;
-if (false !== ($tmp = @mysql_affected_rows()))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (0 !== ($tmp = @mysql_affected_rows()))
+ printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
if (null !== ($tmp = @mysql_affected_rows($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysql/tests/mysql_insert_id.phpt b/ext/mysql/tests/mysql_insert_id.phpt
index 2ef233f943..678245c2cc 100644
--- a/ext/mysql/tests/mysql_insert_id.phpt
+++ b/ext/mysql/tests/mysql_insert_id.phpt
@@ -4,6 +4,7 @@ mysql_insert_id()
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
+require_once('skipifdefaultconnectfailure.inc');
?>
--FILE--
<?php
@@ -12,8 +13,8 @@ include "connect.inc";
$tmp = NULL;
$link = NULL;
-if (false !== ($tmp = @mysql_insert_id()))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (0 !== ($tmp = @mysql_insert_id()))
+ printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_insert_id($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysql/tests/skipifdefaultconnectfailure.inc b/ext/mysql/tests/skipifdefaultconnectfailure.inc
new file mode 100755
index 0000000000..99f3905155
--- /dev/null
+++ b/ext/mysql/tests/skipifdefaultconnectfailure.inc
@@ -0,0 +1,11 @@
+<?php
+if ($skip_on_connect_failure) {
+ if (!$link = @mysql_connect())
+ die(sprintf("skip Can't connect to MySQL Server with default credentials - [%d] %s", mysql_errno(), mysql_error()));
+
+ if (!@mysql_select_db($db, $link))
+ die(sprintf("skip Can't connect to MySQL Server with default credentials - [%d] %s", mysql_errno(), mysql_error()));
+
+ mysql_close($link);
+}
+?>