Page MenuHomePhabricator

testormrowtest.patch

Authored By
bzimport
Nov 22 2014, 12:24 AM
Size
3 KB
Referenced Files
None
Subscribers
None

testormrowtest.patch

diff --git a/tests/phpunit/includes/db/TestORMRowTest.php b/tests/phpunit/includes/db/TestORMRowTest.php
index afd1cb8..bb8f14b 100644
--- a/tests/phpunit/includes/db/TestORMRowTest.php
+++ b/tests/phpunit/includes/db/TestORMRowTest.php
@@ -63,23 +63,46 @@ class TestORMRowTest extends ORMRowTest {
$dbw = wfGetDB( DB_MASTER );
- $isSqlite = $GLOBALS['wgDBtype'] === 'sqlite';
-
- $idField = $isSqlite ? 'INTEGER' : 'INT unsigned';
- $primaryKey = $isSqlite ? 'PRIMARY KEY AUTOINCREMENT' : 'auto_increment PRIMARY KEY';
-
- $dbw->query(
- 'CREATE TABLE IF NOT EXISTS ' . $dbw->tableName( 'orm_test' ) . '(
- test_id ' . $idField . ' NOT NULL ' . $primaryKey . ',
- test_name VARCHAR(255) NOT NULL,
- test_age TINYINT unsigned NOT NULL,
- test_height FLOAT NOT NULL,
- test_awesome TINYINT unsigned NOT NULL,
- test_stuff BLOB NOT NULL,
- test_moarstuff BLOB NOT NULL,
- test_time varbinary(14) NOT NULL
- );'
- );
+ if ( $GLOBALS['wgDBtype'] === 'postgres' ) {
+ $dbw->query(
+ 'CREATE TABLE IF NOT EXISTS ' . $dbw->tableName( 'orm_test' ) . '(
+ test_id SERIAL NOT NULL PRIMARY KEY,
+ test_name VARCHAR(255) NOT NULL,
+ test_age SMALLINT NOT NULL,
+ test_height FLOAT NOT NULL,
+ test_awesome SMALLINT NOT NULL,
+ test_stuff BYTEA NOT NULL,
+ test_moarstuff BYTEA NOT NULL,
+ test_time BYTEA NOT NULL
+ );'
+ );
+ } elseif ( $GLOBALS['wgDBtype'] === 'sqlite' ) {
+ $dbw->query(
+ 'CREATE TABLE IF NOT EXISTS ' . $dbw->tableName( 'orm_test' ) . '(
+ test_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ test_name VARCHAR(255) NOT NULL,
+ test_age TINYINT unsigned NOT NULL,
+ test_height FLOAT NOT NULL,
+ test_awesome TINYINT unsigned NOT NULL,
+ test_stuff BLOB NOT NULL,
+ test_moarstuff BLOB NOT NULL,
+ test_time varbinary(14) NOT NULL
+ );'
+ );
+ } else {
+ $dbw->query(
+ 'CREATE TABLE IF NOT EXISTS ' . $dbw->tableName( 'orm_test' ) . '(
+ test_id INT unsigned NOT NULL auto_increment PRIMARY KEY,
+ test_name VARCHAR(255) NOT NULL,
+ test_age TINYINT unsigned NOT NULL,
+ test_height FLOAT NOT NULL,
+ test_awesome TINYINT unsigned NOT NULL,
+ test_stuff BLOB NOT NULL,
+ test_moarstuff BLOB NOT NULL,
+ test_time varbinary(14) NOT NULL
+ );'
+ );
+ }
}
public function constructorTestProvider() {

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8870
Default Alt Text
testormrowtest.patch (3 KB)

Event Timeline