Commit 1febda11 authored by zYne's avatar zYne

Made the datadict driver testcases adhere to new coding standards

parent 13cd9efa
This diff is collapsed.
......@@ -30,8 +30,10 @@
* @since 1.0
* @version $Revision$
*/
class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() {
class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase
{
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail();
......@@ -39,25 +41,28 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testGetPortableDeclarationSupportsNativeBitType() {
public function testGetPortableDeclarationSupportsNativeBitType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'bit'));
$this->assertEqual($type, array(array('boolean'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeStringTypes() {
public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'text'));
$this->assertEqual($type, array(array('string', 'clob'), null, null, null));
$type = $this->dataDict->getPortableDeclaration(array('type' => 'char', 'length' => 1));
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, true));
$type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar', 'length' => 1));
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, false));
}
public function testGetPortableDeclarationSupportsNativeBlobTypes() {
public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'image'));
$this->assertEqual($type, array(array('blob'), null, null, null));
......@@ -66,7 +71,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeIntegerTypes() {
public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'int'));
$this->assertEqual($type, array(array('integer'), null, null, null));
......@@ -75,12 +81,14 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
}
public function testGetPortableDeclarationSupportsNativeTimestampType() {
public function testGetPortableDeclarationSupportsNativeTimestampType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime'));
$this->assertEqual($type, array(array('timestamp'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeDecimalTypes() {
public function testGetPortableDeclarationSupportsNativeDecimalTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null));
......@@ -89,7 +97,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('decimal'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeFloatTypes() {
public function testGetPortableDeclarationSupportsNativeFloatTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null));
......@@ -102,7 +111,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null));
}
public function testGetNativeDefinitionSupportsIntegerType() {
public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
......@@ -116,67 +126,80 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
}
public function testGetNativeDefinitionSupportsFloatType() {
public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT');
}
public function testGetNativeDefinitionSupportsBooleanType() {
public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIT');
}
public function testGetNativeDefinitionSupportsDateType() {
public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDefinitionSupportsTimestampType() {
public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(19)');
}
public function testGetNativeDefinitionSupportsTimeType() {
public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(8)');
}
public function testGetNativeDefinitionSupportsClobType() {
public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsBlobType() {
public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'IMAGE');
}
public function testGetNativeDefinitionSupportsCharType() {
public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDefinitionSupportsVarcharType() {
public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
}
public function testGetNativeDefinitionSupportsArrayType() {
public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
}
public function testGetNativeDefinitionSupportsStringType() {
public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsArrayType2() {
public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsObjectType() {
public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
......
......@@ -31,13 +31,16 @@
* @version $Revision$
*/
class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
public function testGetCharsetFieldDeclarationReturnsValidSql() {
public function testGetCharsetFieldDeclarationReturnsValidSql()
{
$this->assertEqual($this->dataDict->getCharsetFieldDeclaration('UTF-8'), 'CHARACTER SET UTF-8');
}
public function testGetCollationFieldDeclarationReturnsValidSql() {
public function testGetCollationFieldDeclarationReturnsValidSql()
{
$this->assertEqual($this->dataDict->getCollationFieldDeclaration('xx'), 'COLLATE xx');
}
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail();
......@@ -45,7 +48,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testGetPortableDeclarationSupportsNativeIntegerTypes() {
public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyint'));
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
......@@ -70,7 +74,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer'), 8, true, null));
}
public function testGetPortableDeclarationSupportsNativeStringTypes() {
public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'text'));
$this->assertEqual($type, array(array('string', 'clob'), null, null, false));
......@@ -95,7 +100,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, false));
}
public function testGetPortableDeclarationSupportsNativeFloatTypes() {
public function testGetPortableDeclarationSupportsNativeFloatTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null));
......@@ -109,12 +115,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeDateType() {
public function testGetPortableDeclarationSupportsNativeDateType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('date'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeDecimalTypes() {
public function testGetPortableDeclarationSupportsNativeDecimalTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null));
......@@ -128,7 +136,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('decimal'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeTimestampTypes() {
public function testGetPortableDeclarationSupportsNativeTimestampTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp'));
$this->assertEqual($type, array(array('timestamp'), null, null, null));
......@@ -137,12 +146,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('timestamp'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeYearType() {
public function testGetPortableDeclarationSupportsNativeYearType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'year'));
$this->assertEqual($type, array(array('integer', 'date'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeBlobTypes() {
public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null));
......@@ -160,7 +171,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null));
}
public function testGetNativeDefinitionSupportsIntegerType() {
public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
......@@ -174,72 +186,86 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'SMALLINT');
}
public function testGetNativeDeclarationSupportsFloatType() {
public function testGetNativeDeclarationSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DOUBLE');
}
public function testGetNativeDeclarationSupportsBooleanType() {
public function testGetNativeDeclarationSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TINYINT(1)');
}
public function testGetNativeDeclarationSupportsDateType() {
public function testGetNativeDeclarationSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATE');
}
public function testGetNativeDeclarationSupportsTimestampType() {
public function testGetNativeDeclarationSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATETIME');
}
public function testGetNativeDeclarationSupportsTimeType() {
public function testGetNativeDeclarationSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TIME');
}
public function testGetNativeDeclarationSupportsClobType() {
public function testGetNativeDeclarationSupportsClobType()
{
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGTEXT');
}
public function testGetNativeDeclarationSupportsBlobType() {
public function testGetNativeDeclarationSupportsBlobType()
{
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGBLOB');
}
public function testGetNativeDeclarationSupportsCharType() {
public function testGetNativeDeclarationSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDeclarationSupportsVarcharType() {
public function testGetNativeDeclarationSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(10)');
}
public function testGetNativeDeclarationSupportsArrayType() {
public function testGetNativeDeclarationSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(40)');
}
public function testGetNativeDeclarationSupportsStringType() {
public function testGetNativeDeclarationSupportsStringType()
{
$a = array('type' => 'string');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDeclarationSupportsStringTypeWithLongLength() {
public function testGetNativeDeclarationSupportsStringTypeWithLongLength()
{
$a = array('type' => 'string', 'length' => 2000);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDeclarationSupportsArrayType2() {
public function testGetNativeDeclarationSupportsArrayType2()
{
$a = array('type' => 'array');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDeclarationSupportsObjectType() {
public function testGetNativeDeclarationSupportsObjectType()
{
$a = array('type' => 'object');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
......
......@@ -31,7 +31,8 @@
* @version $Revision$
*/
class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail();
......@@ -39,12 +40,14 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testGetPortableDeclarationSupportsNativeFloatType() {
public function testGetPortableDeclarationSupportsNativeFloatType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeIntegerTypes() {
public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'integer'));
$this->assertEqual($type, array(array('integer'), null, null, null));
......@@ -57,7 +60,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
}
public function testGetPortableDeclarationSupportsNativeStringTypes() {
public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar'));
$this->assertEqual($type, array(array('string'), null, null, null));
......@@ -78,7 +82,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, true));
}
public function testGetPortableDeclarationSupportsNativeNumberType() {
public function testGetPortableDeclarationSupportsNativeNumberType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'number'));
$this->assertEqual($type, array(array('integer'), null, null, null));
......@@ -87,7 +92,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
}
public function testGetPortableDeclarationSupportsNativeTimestampType() {
public function testGetPortableDeclarationSupportsNativeTimestampType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('timestamp'), null, null, null));
......@@ -96,7 +102,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('timestamp'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeClobTypes() {
public function testGetPortableDeclarationSupportsNativeClobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'clob'));
$this->assertEqual($type, array(array('clob'), null, null, null));
......@@ -110,7 +117,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('clob'), null, null, null));
}
public function testGetPortableDeclarationSupportsNativeBlobTypes() {
public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null));
......@@ -127,7 +135,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null));
}
public function testGetNativeDefinitionSupportsIntegerType() {
public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(20)');
......@@ -141,67 +150,80 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(2)');
}
public function testGetNativeDefinitionSupportsFloatType() {
public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER');
}
public function testGetNativeDefinitionSupportsBooleanType() {
public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(1)');
}
public function testGetNativeDefinitionSupportsDateType() {
public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
}
public function testGetNativeDefinitionSupportsTimestampType() {
public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
}
public function testGetNativeDefinitionSupportsTimeType() {
public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
}
public function testGetNativeDefinitionSupportsClobType() {
public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CLOB');
}
public function testGetNativeDefinitionSupportsBlobType() {
public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB');
}
public function testGetNativeDefinitionSupportsCharType() {
public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDefinitionSupportsVarcharType() {
public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(10)');
}
public function testGetNativeDefinitionSupportsArrayType() {
public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(40)');
}
public function testGetNativeDefinitionSupportsStringType() {
public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
}
public function testGetNativeDefinitionSupportsArrayType2() {
public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
}
public function testGetNativeDefinitionSupportsObjectType() {
public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
......
This diff is collapsed.
<?php
class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
public function testBooleanMapsToBooleanType() {
public function testBooleanMapsToBooleanType()
{
$this->assertDeclarationType('boolean', 'boolean');
}
public function testIntegersMapToIntegerType() {
public function testIntegersMapToIntegerType()
{
$this->assertDeclarationType('tinyint', array('integer', 'boolean'));
$this->assertDeclarationType('smallint', 'integer');
$this->assertDeclarationType('mediumint', 'integer');
......@@ -13,25 +15,30 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertDeclarationType('bigint', 'integer');
$this->assertDeclarationType('bigserial', 'integer');
}
public function testBlobsMapToBlobType( ){
public function testBlobsMapToBlobType()
{
$this->assertDeclarationType('tinyblob', 'blob');
$this->assertDeclarationType('mediumblob', 'blob');
$this->assertDeclarationType('longblob', 'blob');
$this->assertDeclarationType('blob', 'blob');
}
public function testDecimalMapsToDecimal() {
public function testDecimalMapsToDecimal()
{
$this->assertDeclarationType('decimal', 'decimal');
$this->assertDeclarationType('numeric', 'decimal');
}
public function testFloatRealAndDoubleMapToFloat() {
public function testFloatRealAndDoubleMapToFloat()
{
$this->assertDeclarationType('float', 'float');
$this->assertDeclarationType('double', 'float');
$this->assertDeclarationType('real', 'float');
}
public function testYearMapsToIntegerAndDate() {
public function testYearMapsToIntegerAndDate()
{
$this->assertDeclarationType('year', array('integer','date'));
}
public function testGetNativeDefinitionSupportsIntegerType() {
public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
......@@ -45,88 +52,82 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
}
public function testGetNativeDefinitionSupportsFloatType() {
public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE');
}
public function testGetNativeDefinitionSupportsBooleanType() {
public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
}
public function testGetNativeDefinitionSupportsDateType() {
public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
}
public function testGetNativeDefinitionSupportsTimestampType() {
public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME');
}
public function testGetNativeDefinitionSupportsTimeType() {
public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME');
}
public function testGetNativeDefinitionSupportsClobType() {
public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT');
}
public function testGetNativeDefinitionSupportsBlobType() {
public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB');
}
public function testGetNativeDefinitionSupportsCharType() {
public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
}
public function testGetNativeDefinitionSupportsVarcharType() {
public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
}
public function testGetNativeDefinitionSupportsArrayType() {
public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
}
public function testGetNativeDefinitionSupportsStringType() {
public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsArrayType2() {
public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testGetNativeDefinitionSupportsObjectType() {
public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
}
public function testSomething() {
/**
$this->assertEqual($this->getDeclaration('clob'), array(array('integer', 'boolean'), 1, false, null));
$this->assertEqual($this->getDeclaration('tinytext'), array(array('integer'), 2, false, null));
$this->assertEqual($this->getDeclaration('mediumtext'), array(array('integer'), 2, false, null));
$this->assertEqual($this->getDeclaration('longtext'), array(array('integer'), 4, false, null));
$this->assertEqual($this->getDeclaration('text'), array(array('integer'), 4, false, null));
$this->assertEqual($this->getDeclaration('varchar'), array(array('integer'), 4, false, null));
$this->assertEqual($this->getDeclaration('varchar2'), array(array('integer'), 8, false, null));
$this->assertEqual($this->getDeclaration('char'), array(array('integer'), 4, false, null));
$this->assertEqual($this->getDeclaration('date'), array(array('integer'), 4, false, null));
$this->assertEqual($this->getDeclaration('datetime'), array(array('integer'), 8, false, null));
$this->assertEqual($this->getDeclaration('timestamp'), array(array('integer'), 8, false, null));
$this->assertEqual($this->getDeclaration('time'), array(array('integer'), 8, false, null));
*/
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment