diff options
author | Nils Adermann <naderman@naderman.de> | 2010-04-01 19:08:11 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-04-01 19:08:11 +0200 |
commit | 53ab8886b1a3a98291627e2baab94ec86c7df685 (patch) | |
tree | 6cddcd7f95f551065ac84c69033bc457977260fe /tests/test_framework | |
parent | 23beaceadd38f694ca2eea3110a20db48328e6ce (diff) | |
download | forums-53ab8886b1a3a98291627e2baab94ec86c7df685.tar forums-53ab8886b1a3a98291627e2baab94ec86c7df685.tar.gz forums-53ab8886b1a3a98291627e2baab94ec86c7df685.tar.bz2 forums-53ab8886b1a3a98291627e2baab94ec86c7df685.tar.xz forums-53ab8886b1a3a98291627e2baab94ec86c7df685.zip |
[feature/dbal-tests] Make the PDO prefix depend on the dbms.
The database base test will need a few more changes to run on all the
databases we support. But those really need to be made on a system where
they run and can be tested. Patches welcome!
Diffstat (limited to 'tests/test_framework')
-rw-r--r-- | tests/test_framework/phpbb_database_test_case.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 84635fc24d..a80f03b749 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -25,38 +25,47 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'firebird' => array( 'SCHEMA' => 'firebird', 'DELIM' => ';;', + 'PDO' => 'firebird', ), 'mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', + 'PDO' => 'mysql', ), 'mysql' => array( 'SCHEMA' => 'mysql', 'DELIM' => ';', + 'PDO' => 'mysql', ), 'mssql' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'mssql_odbc'=> array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', + 'PDO' => 'oci', ), 'postgres' => array( 'SCHEMA' => 'postgres', 'DELIM' => ';', + 'PDO' => 'pgsql', ), 'sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', + 'PDO' => 'sqlite', ), ); @@ -95,13 +104,15 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $this->init_test_case_helpers(); $database_config = $this->test_case_helpers->get_database_config(); + $dbms_data = $this->get_dbms_data($database_config['dbms']); + if ($already_connected) { - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); } else { - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); try { @@ -113,7 +124,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); - $dbms_data = $this->get_dbms_data($database_config['dbms']); if ($database_config['dbms'] == 'mysql') { $pdo->exec('SELECT VERSION() AS version'); |