summaryrefslogtreecommitdiff
path: root/ext/mysql
diff options
context:
space:
mode:
authorTjerk Anne Meesters <datibbaw@php.net>2011-09-12 14:35:45 (GMT)
committerTjerk Anne Meesters <datibbaw@php.net>2011-09-12 14:35:45 (GMT)
commit7b1790bdfbbed54b523dc54cd53417ed2d729536 (patch)
tree359d74b1ca736f91319f623f560b7be738926729 /ext/mysql
parent1c688e06ddf47c8db3bf7bdd0674a9164e3a2a90 (diff)
downloadphp-7b1790bdfbbed54b523dc54cd53417ed2d729536.tar.gz
Reverted changes in connect.inc based on Ulf's feedback
- Moved the ini_set() entries into a separate script 'setupdefault.inc' - Let mysql_affected_rows and mysql_insert_id test cases use the newly created script With the ini_set() statements inside connect.inc, some test cases would be forced to 'undo' them in order to test other scenarios. Tested on all three dev lines with and without passing db credentials. No changes detected.
Diffstat (limited to 'ext/mysql')
-rwxr-xr-xext/mysql/tests/connect.inc5
-rw-r--r--ext/mysql/tests/mysql_affected_rows.phpt1
-rw-r--r--ext/mysql/tests/mysql_insert_id.phpt1
-rw-r--r--ext/mysql/tests/setupdefault.inc10
4 files changed, 12 insertions, 5 deletions
diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc
index 5c2f93d..0df5bc3 100755
--- a/ext/mysql/tests/connect.inc
+++ b/ext/mysql/tests/connect.inc
@@ -65,11 +65,6 @@ $port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
$user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
$passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : "";
-// added so that mysql_connect() without args works as well (required in some tests that rely on a default connection being opened implicitly)
-ini_set('mysql.default_host', $host);
-ini_set('mysql.default_user', $user);
-ini_set('mysql.default_password', $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;
diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt
index 42632bf..145e1f5 100644
--- a/ext/mysql/tests/mysql_affected_rows.phpt
+++ b/ext/mysql/tests/mysql_affected_rows.phpt
@@ -8,6 +8,7 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
include_once("connect.inc");
+include_once('setupdefault.inc');
$tmp = NULL;
$link = NULL;
diff --git a/ext/mysql/tests/mysql_insert_id.phpt b/ext/mysql/tests/mysql_insert_id.phpt
index 51138eb..460d9f3 100644
--- a/ext/mysql/tests/mysql_insert_id.phpt
+++ b/ext/mysql/tests/mysql_insert_id.phpt
@@ -8,6 +8,7 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
include "connect.inc";
+include 'setupdefault.inc';
$tmp = NULL;
$link = NULL;
diff --git a/ext/mysql/tests/setupdefault.inc b/ext/mysql/tests/setupdefault.inc
new file mode 100644
index 0000000..6d25c20
--- /dev/null
+++ b/ext/mysql/tests/setupdefault.inc
@@ -0,0 +1,10 @@
+<?php
+
+// copy variables from connect.inc into mysql default connection ini settings, so that implicit mysql_connect() behaviour can be tested where needed
+// must be loaded AFTER connect.inc
+
+ini_set('mysql.default_host', $host);
+ini_set('mysql.default_user', $user);
+ini_set('mysql.default_password', $passwd);
+
+?>