]> granicus.if.org Git - php/commitdiff
Same as for PHP_5_3: Trying to skip tests if they can't connect to the
authorUlf Wendel <uw@php.net>
Fri, 12 Oct 2007 12:32:39 +0000 (12:32 +0000)
committerUlf Wendel <uw@php.net>
Fri, 12 Oct 2007 12:32:39 +0000 (12:32 +0000)
DB server. Note the environment variable MYSQL_TEST_SKIP_CONNECT_FAILURE
to control if you want tests that can't connect to fail or to be skipped.

15 files changed:
ext/mysql/tests/002.phpt
ext/mysql/tests/003.phpt
ext/mysql/tests/connect.inc
ext/mysql/tests/mysql_affected_rows.phpt
ext/mysql/tests/mysql_client_encoding.phpt
ext/mysql/tests/mysql_close.phpt
ext/mysql/tests/mysql_constants.phpt
ext/mysql/tests/mysql_data_seek.phpt
ext/mysql/tests/mysql_db_name.phpt
ext/mysql/tests/mysql_db_query.phpt
ext/mysql/tests/mysql_errno.phpt
ext/mysql/tests/mysql_error.phpt
ext/mysql/tests/mysql_max_persistent.phpt
ext/mysql/tests/mysql_trace_mode.phpt
ext/mysql/tests/skipifconnectfailure.inc

index 3c628c4116ac56d37cf45f9254311793cd03b197..9c1250104d19f50aed839afea52079d1b4b6bcec 100755 (executable)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_fetch_array
 --SKIPIF--
-<?php include 'skipif.inc'; ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 require_once('connect.inc');
index a113a043e7d4b3eb30da3c6e81e5e4203b74a7db..0c3717b29445f6c57917bea9329fa60173620790 100755 (executable)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_fetch_object
 --SKIPIF--
-<?php include 'skipif.inc'; ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include_once('connect.inc');
index 1585e826a82fca22d6bdd52c398322a747d2d44c..70017b9e2695abf71682982efe096f7cadac9b06 100755 (executable)
@@ -43,7 +43,7 @@ function my_mysql_connect($host, $user, $passwd, $db, $port, $socket) {
 }
 
 /*
-Default values are "localhost", "root", database "phptest" and empty password.
+Default values are "localhost", "root", database "test" and empty password.
 Change the MYSQL_TEST_* environment values if you want to use another configuration.
 */
 
@@ -54,6 +54,7 @@ $passwd       = getenv("MYSQL_TEST_PASSWD")   ? getenv("MYSQL_TEST_PASSWD")   : "";
 $db                    = getenv("MYSQL_TEST_DB")       ? getenv("MYSQL_TEST_DB")       : "test";
 $engine        = getenv("MYSQL_TEST_ENGINE")   ? getenv("MYSQL_TEST_ENGINE")   : "MyISAM";
 $socket        = getenv("MYSQL_TEST_SOCKET")   ? getenv("MYSQL_TEST_SOCKET")   : null;
+$skip_on_connect_failure  = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ? getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") : true;
 
 /* Development setting: test experimal features and/or feature requests that never worked before? */
 $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
index 64b2d161d2abfc36d1c15a8ca688e3ff1aa9dcd5..246991fa666d3999e1fd909f27d152e082402c55 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_affected_rows()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include_once("connect.inc");
index fe94490d06ee6ba300a887dfb5181011bdc5954f..399b1e8704c7fd421d31fb6164604e5bad487b91 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_client_encoding()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include_once "connect.inc";
index 19b13b74a497d02752308ffbb2aece4584fbd02f..aab3553f7257c2f6e5caf7e384e2fecfc2f10c18 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_close()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index e20d32a34631c985b567ca11e370db6566bdd9c1..e88e6556f887d24f6d228251401bba78c9b23a18 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Constants exported by ext/mysql
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 require("connect.inc");
index 21ebad692bced458a5f1f44e77088a52682d5d69..24f930dea8a6e6a45c295dc414c2ef048ff29eab 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_data_seek()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index 8e81c76e95c4b06fc1d4985d8504a636c38da0f0..7341259788e69d2113742cf474e2bda6f1e36808 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_db_name()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index 421e9f592dc8df1f9b1bfa28863c1b7af27fc456..be7f87ac2189734b9347e67f505227977da0f064 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_db_query()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index 288376ae82c0322b32d2680001aa98c52d56bf3c..fd76f226cd9315b1a91b812409087c50c71b29cf 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_errno()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index afdd90c338b93f09fc50c01ee75634a944d4451d..2b3acb7197739f2e54156d93adfc394a171d8197 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql_error()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 include "connect.inc";
index 50c8d375e5e61195a71c7aedc426eb9d53bf4533..498b5c5d36815307c0c278a504098bfb489a3402 100644 (file)
@@ -3,6 +3,7 @@ mysql_[p]connect() - max_links/max_persistent
 --SKIPIF--
 <?php
 require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 $link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket);
index 86fa5e081b33c092421e92a28d117ba7c1350f2e..b1bdd3dc153b9e5676ca689a00be179af67aab6c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 mysql.trace_mode=1
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --INI--
 mysql.trace_mode=1
 error_reporting=E_ALL | E_NOTICE | E_STRICT
index 2fe4090daf8b48a2513f0a6a96e6775c2d0a1f50..e586a33f3b0583bbe6358b04d42e879f384da6cb 100755 (executable)
@@ -1,17 +1,17 @@
 <?php
-$skip_on_connect_failure  = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ? getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") : false;
+require_once('connect.inc');
 if ($skip_on_connect_failure) {
        if ($socket)
                $myhost = sprintf("%s:%s", $host, $socket);
        else if ($port)
                $myhost = sprintf("%s:%s", $host, $port);
-       
+
        if (!$link = @mysql_connect($myhost, $user, $passwd, true))
                die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysql_errno(), mysql_error()));
 
        if (!@mysql_select_db($db, $link))
                die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysql_errno(), mysql_error()));
-               
+
        mysql_close($link);
 }
 ?>
\ No newline at end of file