diff options
author | Ulf Wendel <uw@php.net> | 2007-10-12 11:57:18 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2007-10-12 11:57:18 +0000 |
commit | f8156f160741c0399b9f9d938a1582ed9c19bf89 (patch) | |
tree | 86c74ab69282a82be1eaa1f24df97b05a83a4fa1 /ext/mysql | |
parent | be87d68c0e7c0cd8de3e3fbd9ba27019e5eb7703 (diff) | |
download | php-git-f8156f160741c0399b9f9d938a1582ed9c19bf89.tar.gz |
Trying to skip tests if they can't connect to the DB server.
Currently they have failed by default. Note also the environment
variable MYSQL_TEST_SKIP_CONNECT_FAILURE to control the default (skip or fail)
Diffstat (limited to 'ext/mysql')
-rwxr-xr-x | ext/mysql/tests/002.phpt | 5 | ||||
-rwxr-xr-x | ext/mysql/tests/003.phpt | 5 | ||||
-rwxr-xr-x | ext/mysql/tests/connect.inc | 3 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_affected_rows.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_client_encoding.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_close.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_constants.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_data_seek.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_db_name.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_db_query.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_errno.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_error.phpt | 5 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_max_persistent.phpt | 1 | ||||
-rw-r--r-- | ext/mysql/tests/mysql_trace_mode.phpt | 5 | ||||
-rwxr-xr-x | ext/mysql/tests/skipifconnectfailure.inc | 6 |
15 files changed, 54 insertions, 16 deletions
diff --git a/ext/mysql/tests/002.phpt b/ext/mysql/tests/002.phpt index 3c628c4116..9c1250104d 100755 --- a/ext/mysql/tests/002.phpt +++ b/ext/mysql/tests/002.phpt @@ -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'); diff --git a/ext/mysql/tests/003.phpt b/ext/mysql/tests/003.phpt index a113a043e7..0c3717b294 100755 --- a/ext/mysql/tests/003.phpt +++ b/ext/mysql/tests/003.phpt @@ -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'); diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc index 1585e826a8..70017b9e26 100755 --- a/ext/mysql/tests/connect.inc +++ b/ext/mysql/tests/connect.inc @@ -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))) ? diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt index 64b2d161d2..246991fa66 100644 --- a/ext/mysql/tests/mysql_affected_rows.phpt +++ b/ext/mysql/tests/mysql_affected_rows.phpt @@ -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"); diff --git a/ext/mysql/tests/mysql_client_encoding.phpt b/ext/mysql/tests/mysql_client_encoding.phpt index fe94490d06..399b1e8704 100644 --- a/ext/mysql/tests/mysql_client_encoding.phpt +++ b/ext/mysql/tests/mysql_client_encoding.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_close.phpt b/ext/mysql/tests/mysql_close.phpt index 19b13b74a4..aab3553f72 100644 --- a/ext/mysql/tests/mysql_close.phpt +++ b/ext/mysql/tests/mysql_close.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_constants.phpt b/ext/mysql/tests/mysql_constants.phpt index e20d32a346..e88e6556f8 100644 --- a/ext/mysql/tests/mysql_constants.phpt +++ b/ext/mysql/tests/mysql_constants.phpt @@ -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"); diff --git a/ext/mysql/tests/mysql_data_seek.phpt b/ext/mysql/tests/mysql_data_seek.phpt index 21ebad692b..24f930dea8 100644 --- a/ext/mysql/tests/mysql_data_seek.phpt +++ b/ext/mysql/tests/mysql_data_seek.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_db_name.phpt b/ext/mysql/tests/mysql_db_name.phpt index 8e81c76e95..7341259788 100644 --- a/ext/mysql/tests/mysql_db_name.phpt +++ b/ext/mysql/tests/mysql_db_name.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_db_query.phpt b/ext/mysql/tests/mysql_db_query.phpt index 421e9f592d..be7f87ac21 100644 --- a/ext/mysql/tests/mysql_db_query.phpt +++ b/ext/mysql/tests/mysql_db_query.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_errno.phpt b/ext/mysql/tests/mysql_errno.phpt index 288376ae82..fd76f226cd 100644 --- a/ext/mysql/tests/mysql_errno.phpt +++ b/ext/mysql/tests/mysql_errno.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_error.phpt b/ext/mysql/tests/mysql_error.phpt index afdd90c338..2b3acb7197 100644 --- a/ext/mysql/tests/mysql_error.phpt +++ b/ext/mysql/tests/mysql_error.phpt @@ -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"; diff --git a/ext/mysql/tests/mysql_max_persistent.phpt b/ext/mysql/tests/mysql_max_persistent.phpt index 50c8d375e5..498b5c5d36 100644 --- a/ext/mysql/tests/mysql_max_persistent.phpt +++ b/ext/mysql/tests/mysql_max_persistent.phpt @@ -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); diff --git a/ext/mysql/tests/mysql_trace_mode.phpt b/ext/mysql/tests/mysql_trace_mode.phpt index 86fa5e081b..b1bdd3dc15 100644 --- a/ext/mysql/tests/mysql_trace_mode.phpt +++ b/ext/mysql/tests/mysql_trace_mode.phpt @@ -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 diff --git a/ext/mysql/tests/skipifconnectfailure.inc b/ext/mysql/tests/skipifconnectfailure.inc index 2fe4090daf..e586a33f3b 100755 --- a/ext/mysql/tests/skipifconnectfailure.inc +++ b/ext/mysql/tests/skipifconnectfailure.inc @@ -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 |