]> granicus.if.org Git - php/commitdiff
Reverted changes in connect.inc based on Ulf's feedback
authorTjerk Anne Meesters <datibbaw@php.net>
Mon, 12 Sep 2011 14:35:45 +0000 (14:35 +0000)
committerTjerk Anne Meesters <datibbaw@php.net>
Mon, 12 Sep 2011 14:35:45 +0000 (14:35 +0000)
- 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.

ext/mysql/tests/connect.inc
ext/mysql/tests/mysql_affected_rows.phpt
ext/mysql/tests/mysql_insert_id.phpt
ext/mysql/tests/setupdefault.inc [new file with mode: 0644]

index 5c2f93d8f03f431e2ee86f9f7efb7ece202481ac..0df5bc3aa0c7dff9ded4caae1c702f62663fd35d 100755 (executable)
@@ -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;
index 42632bf8d7f65ec022f92cf499a41bf5aa190f07..145e1f5c0b95a9a27d11797b5430fedcb4bbd0a6 100644 (file)
@@ -8,6 +8,7 @@ require_once('skipifconnectfailure.inc');
 --FILE--
 <?php
 include_once("connect.inc");
+include_once('setupdefault.inc');
 
 $tmp    = NULL;
 $link   = NULL;
index 51138ebdd49bdaa65e821402d0c6ee5bab903e26..460d9f3f4d6b6dd12d4c2f65ab827fa84bcfc883 100644 (file)
@@ -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 (file)
index 0000000..6d25c20
--- /dev/null
@@ -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);
+
+?>