From 92019f99a40c322fe7911f074f9630b11bb5c06e Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 7 Sep 2012 14:08:23 +0000 Subject: [PATCH] Created separate mysql config file for tests --- .../webim/classes/DatabaseTest.php | 32 +++++++++---------- .../webim/classes/SettingsTest.php | 15 ++++++++- .../server_side/webim/database_config.php | 13 ++++++++ 3 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 src/messenger/tests/server_side/webim/database_config.php diff --git a/src/messenger/tests/server_side/webim/classes/DatabaseTest.php b/src/messenger/tests/server_side/webim/classes/DatabaseTest.php index ad05dfde..5d880c36 100644 --- a/src/messenger/tests/server_side/webim/classes/DatabaseTest.php +++ b/src/messenger/tests/server_side/webim/classes/DatabaseTest.php @@ -1,7 +1,7 @@ exec( "CREATE TABLE phpunit_test_only " . @@ -48,11 +48,11 @@ class DatabaseTest extends PHPUnit_Framework_TestCase { } public static function tearDownAfterClass() { - global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb; + global $db_host, $db_user, $db_pass, $db_name; $dbh = new PDO( - "mysql:host={$mysqlhost};dbname={$mysqldb}", - $mysqllogin, - $mysqlpass + "mysql:host={$db_host};dbname={$db_name}", + $db_user, + $db_pass ); $dbh->exec("DROP TABLE phpunit_test_only"); $dbh = NULL; diff --git a/src/messenger/tests/server_side/webim/classes/SettingsTest.php b/src/messenger/tests/server_side/webim/classes/SettingsTest.php index 8a21db9e..805d4f75 100644 --- a/src/messenger/tests/server_side/webim/classes/SettingsTest.php +++ b/src/messenger/tests/server_side/webim/classes/SettingsTest.php @@ -1,8 +1,8 @@ query( "INSERT INTO {chatconfig} (vckey, vcvalue) " . @@ -25,6 +37,7 @@ class SettingsTest extends PHPUnit_Framework_TestCase { "DELETE FROM {chatconfig} WHERE vckey = ? OR vckey = ?", array('some_test_key', 'some_another_test_key') ); + Database::destroy(); } public function testGet() { diff --git a/src/messenger/tests/server_side/webim/database_config.php b/src/messenger/tests/server_side/webim/database_config.php new file mode 100644 index 00000000..9f96231e --- /dev/null +++ b/src/messenger/tests/server_side/webim/database_config.php @@ -0,0 +1,13 @@ + \ No newline at end of file