datibbaw Mon, 12 Sep 2011 14:35:45 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316547
Log:
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.
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
U php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_affected_rows.phpt
U php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_insert_id.phpt
A php/php-src/branches/PHP_5_3/ext/mysql/tests/setupdefault.inc
U php/php-src/branches/PHP_5_4/ext/mysql/tests/connect.inc
U php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_affected_rows.phpt
U php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_insert_id.phpt
A php/php-src/branches/PHP_5_4/ext/mysql/tests/setupdefault.inc
U php/php-src/trunk/ext/mysql/tests/connect.inc
U php/php-src/trunk/ext/mysql/tests/mysql_affected_rows.phpt
U php/php-src/trunk/ext/mysql/tests/mysql_insert_id.phpt
A php/php-src/trunk/ext/mysql/tests/setupdefault.inc
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2011-09-12
14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2011-09-12
14:35:45 UTC (rev 316547)
@@ -65,11 +65,6 @@
$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;
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_affected_rows.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_affected_rows.phpt
2011-09-12 14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_affected_rows.phpt
2011-09-12 14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include_once("connect.inc");
+include_once('setupdefault.inc');
$tmp = NULL;
$link = NULL;
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_insert_id.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_insert_id.phpt
2011-09-12 14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_insert_id.phpt
2011-09-12 14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include "connect.inc";
+include 'setupdefault.inc';
$tmp = NULL;
$link = NULL;
Added: php/php-src/branches/PHP_5_3/ext/mysql/tests/setupdefault.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/setupdefault.inc
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/setupdefault.inc
2011-09-12 14:35:45 UTC (rev 316547)
@@ -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);
+
+?>
Modified: php/php-src/branches/PHP_5_4/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/tests/connect.inc 2011-09-12
14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_4/ext/mysql/tests/connect.inc 2011-09-12
14:35:45 UTC (rev 316547)
@@ -65,11 +65,6 @@
$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;
Modified: php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_affected_rows.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_affected_rows.phpt
2011-09-12 14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_affected_rows.phpt
2011-09-12 14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include_once("connect.inc");
+include_once('setupdefault.inc');
$tmp = NULL;
$link = NULL;
Modified: php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_insert_id.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_insert_id.phpt
2011-09-12 14:35:29 UTC (rev 316546)
+++ php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_insert_id.phpt
2011-09-12 14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include "connect.inc";
+include 'setupdefault.inc';
$tmp = NULL;
$link = NULL;
Added: php/php-src/branches/PHP_5_4/ext/mysql/tests/setupdefault.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/tests/setupdefault.inc
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/mysql/tests/setupdefault.inc
2011-09-12 14:35:45 UTC (rev 316547)
@@ -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);
+
+?>
Modified: php/php-src/trunk/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/trunk/ext/mysql/tests/connect.inc 2011-09-12 14:35:29 UTC
(rev 316546)
+++ php/php-src/trunk/ext/mysql/tests/connect.inc 2011-09-12 14:35:45 UTC
(rev 316547)
@@ -65,11 +65,6 @@
$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;
Modified: php/php-src/trunk/ext/mysql/tests/mysql_affected_rows.phpt
===================================================================
--- php/php-src/trunk/ext/mysql/tests/mysql_affected_rows.phpt 2011-09-12
14:35:29 UTC (rev 316546)
+++ php/php-src/trunk/ext/mysql/tests/mysql_affected_rows.phpt 2011-09-12
14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include_once("connect.inc");
+include_once('setupdefault.inc');
$tmp = NULL;
$link = NULL;
Modified: php/php-src/trunk/ext/mysql/tests/mysql_insert_id.phpt
===================================================================
--- php/php-src/trunk/ext/mysql/tests/mysql_insert_id.phpt 2011-09-12
14:35:29 UTC (rev 316546)
+++ php/php-src/trunk/ext/mysql/tests/mysql_insert_id.phpt 2011-09-12
14:35:45 UTC (rev 316547)
@@ -8,6 +8,7 @@
--FILE--
<?php
include "connect.inc";
+include 'setupdefault.inc';
$tmp = NULL;
$link = NULL;
Added: php/php-src/trunk/ext/mysql/tests/setupdefault.inc
===================================================================
--- php/php-src/trunk/ext/mysql/tests/setupdefault.inc
(rev 0)
+++ php/php-src/trunk/ext/mysql/tests/setupdefault.inc 2011-09-12 14:35:45 UTC
(rev 316547)
@@ -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);
+
+?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php