]> granicus.if.org Git - php/commitdiff
fix tests
authorAntony Dovgal <tony2001@php.net>
Sat, 29 Aug 2009 19:18:27 +0000 (19:18 +0000)
committerAntony Dovgal <tony2001@php.net>
Sat, 29 Aug 2009 19:18:27 +0000 (19:18 +0000)
ext/mysql/tests/mysql_affected_rows.phpt
ext/mysql/tests/mysql_insert_id.phpt
ext/mysql/tests/skipifdefaultconnectfailure.inc [new file with mode: 0755]

index 3001bf14ce8af92db5b0c6986edc460c282a1180..ce16a7748c397f136d0823c98ec8978756af1792 100644 (file)
@@ -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);
index 2ef233f943c7144624f278d214acc6209051d1a0..678245c2cc00df9e51e8055e9083691988f84524 100644 (file)
@@ -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 (executable)
index 0000000..99f3905
--- /dev/null
@@ -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);
+}
+?>