1
0
mirror of synced 2025-01-29 19:41:45 +03:00

updated datadict driver test cases

This commit is contained in:
zYne 2006-11-28 18:39:31 +00:00
parent 570bc068d2
commit b8257aad63
3 changed files with 62 additions and 27 deletions

View File

@ -6,7 +6,7 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
public function testGetNativeDefinitionSupportsIntegerType() {
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
$a['length'] = 4;
@ -14,18 +14,18 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
$a['length'] = 2;
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
}
public function testGetNativeDefinitionSupportsFloatType() {
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE PRECISION');
}
public function testGetNativeDefinitionSupportsBooleanType() {
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TINYINT(1)');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT');
}
public function testGetNativeDefinitionSupportsDateType() {
$a = array('type' => 'date', 'fixed' => false);
@ -35,7 +35,7 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
public function testGetNativeDefinitionSupportsTimestampType() {
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP');
}
public function testGetNativeDefinitionSupportsTimeType() {
$a = array('type' => 'time', 'fixed' => false);
@ -45,12 +45,12 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
public function testGetNativeDefinitionSupportsClobType() {
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 1');
}
public function testGetNativeDefinitionSupportsBlobType() {
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 0');
}
public function testGetNativeDefinitionSupportsCharType() {
$a = array('type' => 'char', 'length' => 10);
@ -70,16 +70,16 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
public function testGetNativeDefinitionSupportsStringType() {
$a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
}
public function testGetNativeDefinitionSupportsArrayType2() {
$a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
}
public function testGetNativeDefinitionSupportsObjectType() {
$a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
}
}

View File

@ -6,7 +6,7 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_Driver_UnitTestCase {
public function testGetNativeDefinitionSupportsIntegerType() {
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
$a['length'] = 4;
@ -14,43 +14,43 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_Driver_UnitTestCase {
$a['length'] = 2;
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
}
public function testGetNativeDefinitionSupportsFloatType() {
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT');
}
public function testGetNativeDefinitionSupportsBooleanType() {
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TINYINT(1)');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIT');
}
public function testGetNativeDefinitionSupportsDateType() {
$a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDefinitionSupportsTimestampType() {
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(19)');
}
public function testGetNativeDefinitionSupportsTimeType() {
$a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(8)');
}
public function testGetNativeDefinitionSupportsClobType() {
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsBlobType() {
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'IMAGE');
}
public function testGetNativeDefinitionSupportsCharType() {
$a = array('type' => 'char', 'length' => 10);

View File

@ -60,11 +60,45 @@ require_once('BooleanTestCase.php');
require_once('EnumTestCase.php');
require_once('DataDictSqliteTestCase.php');
require_once('DataDict/PgsqlTestCase.php');
require_once('DataDict/SqliteTestCase.php');
require_once('DataDict/MysqlTestCase.php');
require_once('DataDict/OracleTestCase.php');
$drivers = array('Firebird',
'Informix',
'Mysql',
'Mssql',
'Oracle',
'Pgsql',
'Sqlite'
);
foreach($drivers as $driver) {
require_once('DataDict/' . $driver . 'TestCase.php');
}
/**
class Doctrine_Tester {
protected $drivers = array('Firebird',
'Informix',
'Mysql',
'Mssql',
'Oracle',
'Pgsql',
'Sqlite'
);
public function loadModule($module) {
foreach($drivers as $driver) {
require_once($module . DIRECTORY_SEPARATOR . $driver . 'TestCase.php');
}
}
public function run($module) {
$this->loadModule($module);
foreach($drivers as $driver) {
}
}
}
*/
require_once('ExportTestCase.php');
require_once('ExportMysqlTestCase.php');
require_once('ExportFirebirdTestCase.php');
@ -94,11 +128,12 @@ $test->addTestCase(new Doctrine_Connection_Mysql_TestCase());
$test->addTestCase(new Doctrine_Export_Mysql_TestCase());
$test->addTestCase(new Doctrine_DataDict_Pgsql_TestCase());
foreach($drivers as $driver) {
$class = 'Doctrine_DataDict_' . $driver . '_TestCase';
$test->addTestCase(new $class());
}
$test->addTestCase(new Doctrine_DataDict_Mysql_TestCase());
$test->addTestCase(new Doctrine_DataDict_Oracle_TestCase());
/**
$test->addTestCase(new Doctrine_DataDict_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Configurable_TestCase());