diff options
author | Nils Adermann <naderman@naderman.de> | 2014-05-02 17:57:22 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2014-05-02 17:57:22 +0200 |
commit | f0be9549ac14c49cad44b1476382aedf2a6f4af8 (patch) | |
tree | 561c55b0db3d3908d57095601a4483a920b02736 /tests | |
parent | 1dd02b0a916f1cd7672ffc247f09c9b6d4598d7c (diff) | |
parent | 5496dd41ed04cf41bca15c6f9a9e9439d213100b (diff) | |
download | forums-f0be9549ac14c49cad44b1476382aedf2a6f4af8.tar forums-f0be9549ac14c49cad44b1476382aedf2a6f4af8.tar.gz forums-f0be9549ac14c49cad44b1476382aedf2a6f4af8.tar.bz2 forums-f0be9549ac14c49cad44b1476382aedf2a6f4af8.tar.xz forums-f0be9549ac14c49cad44b1476382aedf2a6f4af8.zip |
Merge remote-tracking branch 'github-nickvergessen/feature/sqlite3' into develop-ascraeus
* github-nickvergessen/feature/sqlite3:
[feature/sqlite3] Add sqlite3 database to .gitignore
[feature/sqlite3] Use SQLite3 by default
[feature/sqlite3] Remove invalid comment
[feature/sqlite3] Remove unneeded ORDER BY type from sqlite_master queries
[feature/sqlite3] Correctly recreate indexes when recreating a table
[feature/sqlite3] Fix sql_index_drop() for sqlite3
[feature/sqlite3] Remove trailing comma from column list
[feature/sqlite3] Update docblocks and function visibility
[feature/sqlite3] Add support for SQLite 3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 22 | ||||
-rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 14 |
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 887dad5b50..796a6e57cf 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -53,6 +53,7 @@ class phpbb_database_test_connection_manager switch ($this->dbms['PDO']) { case 'sqlite2': + case 'sqlite': // SQLite3 driver $dsn .= $this->config['dbhost']; break; @@ -191,6 +192,7 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { case 'phpbb\db\driver\sqlite': + case 'phpbb\db\driver\sqlite3': case 'phpbb\db\driver\firebird': $this->connect(); // Drop all of the tables @@ -272,6 +274,13 @@ class phpbb_database_test_connection_manager WHERE type = "table"'; break; + case 'phpbb\db\driver\sqlite3': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table" + AND name <> "sqlite_sequence"'; + break; + case 'phpbb\db\driver\mssql': case 'phpbb\db\driver\mssql_odbc': case 'phpbb\db\driver\mssqlnative': @@ -436,6 +445,11 @@ class phpbb_database_test_connection_manager 'DELIM' => ';', 'PDO' => 'sqlite2', ), + 'phpbb\db\driver\sqlite3' => array( + 'SCHEMA' => 'sqlite', + 'DELIM' => ';', + 'PDO' => 'sqlite', + ), ); if (isset($available_dbms[$dbms])) @@ -623,6 +637,14 @@ class phpbb_database_test_connection_manager $queries[] = 'SELECT ' . implode(', ', $setval_queries); } break; + + case 'phpbb\db\driver\sqlite3': + /** + * Just delete all of the sequences. When an insertion occurs, the sequence will be automatically + * re-created from the key with the AUTOINCREMENT attribute + */ + $queries[] = 'DELETE FROM sqlite_sequence'; + break; } foreach ($queries as $query) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 2f225fe7af..aba63a0498 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -104,7 +104,19 @@ class phpbb_test_case_helpers { $config = array(); - if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + + if (extension_loaded('sqlite3')) + { + $config = array_merge($config, array( + 'dbms' => 'phpbb\db\driver\sqlite3', + 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite3', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + )); + } + else if (extension_loaded('sqlite')) { $config = array_merge($config, array( 'dbms' => 'phpbb\db\driver\sqlite', |