Commit 1febda11 authored by zYne's avatar zYne

Made the datadict driver testcases adhere to new coding standards

parent 13cd9efa
...@@ -30,14 +30,18 @@ ...@@ -30,14 +30,18 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase { class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase
public function testGetCharsetFieldDeclarationReturnsValidSql() { {
public function testGetCharsetFieldDeclarationReturnsValidSql()
{
$this->assertEqual($this->dataDict->getCharsetFieldDeclaration('UTF-8'), 'CHARACTER SET UTF-8'); $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'); $this->assertEqual($this->dataDict->getCollationFieldDeclaration('xx'), 'COLLATE xx');
} }
public function testGetPortableDeclarationForUnknownDbTypeThrowsException() { public function testGetPortableDeclarationForUnknownDbTypeThrowsException()
{
try { try {
$this->dataDict->getPortableDeclaration(array('type' => 'unknown')); $this->dataDict->getPortableDeclaration(array('type' => 'unknown'));
$this->fail(); $this->fail();
...@@ -45,27 +49,32 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase { ...@@ -45,27 +49,32 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->pass(); $this->pass();
} }
} }
public function testGetPortableDeclarationSupportsNativeDateType() { public function testGetPortableDeclarationSupportsNativeDateType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('date'), null, null, null)); $this->assertEqual($type, array(array('date'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimestampType() { public function testGetPortableDeclarationSupportsNativeTimestampType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp'));
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimeType() { public function testGetPortableDeclarationSupportsNativeTimeType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'time')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'time'));
$this->assertEqual($type, array(array('time'), null, null, null)); $this->assertEqual($type, array(array('time'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeFloatType() { public function testGetPortableDeclarationSupportsNativeFloatType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDoubleType() { public function testGetPortableDeclarationSupportsNativeDoubleType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'double')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'double'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
...@@ -75,52 +84,62 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase { ...@@ -75,52 +84,62 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDfloatType() { public function testGetPortableDeclarationSupportsNativeDfloatType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'd_float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'd_float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDecimalType() { public function testGetPortableDeclarationSupportsNativeDecimalType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeNumericType() { public function testGetPortableDeclarationSupportsNativeNumericType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric'));
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeBlobType() { public function testGetPortableDeclarationSupportsNativeBlobType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeVarcharType() { public function testGetPortableDeclarationSupportsNativeVarcharType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar'));
$this->assertEqual($type, array(array('string'), null, null, false)); $this->assertEqual($type, array(array('string'), null, null, false));
} }
public function testGetPortableDeclarationSupportsNativeCharType() { public function testGetPortableDeclarationSupportsNativeCharType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'char')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'char'));
$this->assertEqual($type, array(array('string'), null, null, true)); $this->assertEqual($type, array(array('string'), null, null, true));
} }
public function testGetPortableDeclarationSupportsNativeCstringType() { public function testGetPortableDeclarationSupportsNativeCstringType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'cstring')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'cstring'));
$this->assertEqual($type, array(array('string'), null, null, true)); $this->assertEqual($type, array(array('string'), null, null, true));
} }
public function testGetPortableDeclarationSupportsNativeBigintType() { public function testGetPortableDeclarationSupportsNativeBigintType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'bigint')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'bigint'));
$this->assertEqual($type, array(array('integer'), null, null, null)); $this->assertEqual($type, array(array('integer'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeQuadType() { public function testGetPortableDeclarationSupportsNativeQuadType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'quad')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'quad'));
$this->assertEqual($type, array(array('integer'), null, null, null)); $this->assertEqual($type, array(array('integer'), null, null, null));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
...@@ -134,67 +153,80 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase { ...@@ -134,67 +153,80 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
} }
public function testGetNativeDefinitionSupportsFloatType() { public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE PRECISION'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE PRECISION');
} }
public function testGetNativeDefinitionSupportsBooleanType() { public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT');
} }
public function testGetNativeDefinitionSupportsDateType() { public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsTimestampType() { public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP');
} }
public function testGetNativeDefinitionSupportsTimeType() { public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME');
} }
public function testGetNativeDefinitionSupportsClobType() { public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 1'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 1');
} }
public function testGetNativeDefinitionSupportsBlobType() { public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 0'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 0');
} }
public function testGetNativeDefinitionSupportsCharType() { public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsVarcharType() { public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
} }
public function testGetNativeDefinitionSupportsArrayType() { public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
} }
public function testGetNativeDefinitionSupportsStringType() { public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
} }
public function testGetNativeDefinitionSupportsArrayType2() { public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
} }
public function testGetNativeDefinitionSupportsObjectType() { public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)');
......
...@@ -30,8 +30,10 @@ ...@@ -30,8 +30,10 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() { {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try { try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail(); $this->fail();
...@@ -39,25 +41,28 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -39,25 +41,28 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->pass(); $this->pass();
} }
} }
public function testGetPortableDeclarationSupportsNativeBitType() { public function testGetPortableDeclarationSupportsNativeBitType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'bit')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'bit'));
$this->assertEqual($type, array(array('boolean'), null, null, null)); $this->assertEqual($type, array(array('boolean'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeStringTypes() { public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'text'));
$this->assertEqual($type, array(array('string', 'clob'), null, null, null)); $this->assertEqual($type, array(array('string', 'clob'), null, null, null));
$type = $this->dataDict->getPortableDeclaration(array('type' => 'char', 'length' => 1)); $type = $this->dataDict->getPortableDeclaration(array('type' => 'char', 'length' => 1));
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, true)); $this->assertEqual($type, array(array('string', 'boolean'), 1, null, true));
$type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar', 'length' => 1)); $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar', 'length' => 1));
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, false)); $this->assertEqual($type, array(array('string', 'boolean'), 1, null, false));
} }
public function testGetPortableDeclarationSupportsNativeBlobTypes() { public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'image')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'image'));
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
...@@ -66,7 +71,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -66,7 +71,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeIntegerTypes() { public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'int')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'int'));
$this->assertEqual($type, array(array('integer'), null, null, null)); $this->assertEqual($type, array(array('integer'), null, null, null));
...@@ -75,12 +81,14 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -75,12 +81,14 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null)); $this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimestampType() { public function testGetPortableDeclarationSupportsNativeTimestampType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime'));
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDecimalTypes() { public function testGetPortableDeclarationSupportsNativeDecimalTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
...@@ -89,7 +97,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -89,7 +97,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeFloatTypes() { public function testGetPortableDeclarationSupportsNativeFloatTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
...@@ -102,7 +111,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -102,7 +111,8 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
...@@ -116,67 +126,80 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase { ...@@ -116,67 +126,80 @@ class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT');
} }
public function testGetNativeDefinitionSupportsFloatType() { public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT');
} }
public function testGetNativeDefinitionSupportsBooleanType() { public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIT');
} }
public function testGetNativeDefinitionSupportsDateType() { public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsTimestampType() { public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(19)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(19)');
} }
public function testGetNativeDefinitionSupportsTimeType() { public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(8)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(8)');
} }
public function testGetNativeDefinitionSupportsClobType() { public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsBlobType() { public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'IMAGE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'IMAGE');
} }
public function testGetNativeDefinitionSupportsCharType() { public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsVarcharType() { public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
} }
public function testGetNativeDefinitionSupportsArrayType() { public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
} }
public function testGetNativeDefinitionSupportsStringType() { public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsArrayType2() { public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsObjectType() { public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
......
...@@ -31,13 +31,16 @@ ...@@ -31,13 +31,16 @@
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { 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'); $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'); $this->assertEqual($this->dataDict->getCollationFieldDeclaration('xx'), 'COLLATE xx');
} }
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() { public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try { try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail(); $this->fail();
...@@ -45,7 +48,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -45,7 +48,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->pass(); $this->pass();
} }
} }
public function testGetPortableDeclarationSupportsNativeIntegerTypes() { public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyint')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyint'));
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null)); $this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
...@@ -70,7 +74,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -70,7 +74,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer'), 8, true, null)); $this->assertEqual($type, array(array('integer'), 8, true, null));
} }
public function testGetPortableDeclarationSupportsNativeStringTypes() { public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'text'));
$this->assertEqual($type, array(array('string', 'clob'), null, null, false)); $this->assertEqual($type, array(array('string', 'clob'), null, null, false));
...@@ -95,7 +100,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -95,7 +100,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, false)); $this->assertEqual($type, array(array('string', 'boolean'), 1, null, false));
} }
public function testGetPortableDeclarationSupportsNativeFloatTypes() { public function testGetPortableDeclarationSupportsNativeFloatTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
...@@ -109,12 +115,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -109,12 +115,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDateType() { public function testGetPortableDeclarationSupportsNativeDateType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('date'), null, null, null)); $this->assertEqual($type, array(array('date'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDecimalTypes() { public function testGetPortableDeclarationSupportsNativeDecimalTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
...@@ -128,7 +136,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -128,7 +136,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimestampTypes() { public function testGetPortableDeclarationSupportsNativeTimestampTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp'));
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
...@@ -137,12 +146,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -137,12 +146,14 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeYearType() { public function testGetPortableDeclarationSupportsNativeYearType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'year')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'year'));
$this->assertEqual($type, array(array('integer', 'date'), null, null, null)); $this->assertEqual($type, array(array('integer', 'date'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeBlobTypes() { public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
...@@ -160,7 +171,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -160,7 +171,8 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
...@@ -174,72 +186,86 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { ...@@ -174,72 +186,86 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'SMALLINT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'SMALLINT');
} }
public function testGetNativeDeclarationSupportsFloatType() { public function testGetNativeDeclarationSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DOUBLE'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DOUBLE');
} }
public function testGetNativeDeclarationSupportsBooleanType() { public function testGetNativeDeclarationSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TINYINT(1)'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TINYINT(1)');
} }
public function testGetNativeDeclarationSupportsDateType() { public function testGetNativeDeclarationSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDeclarationSupportsTimestampType() { public function testGetNativeDeclarationSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATETIME'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATETIME');
} }
public function testGetNativeDeclarationSupportsTimeType() { public function testGetNativeDeclarationSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TIME'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TIME');
} }
public function testGetNativeDeclarationSupportsClobType() { public function testGetNativeDeclarationSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGTEXT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGTEXT');
} }
public function testGetNativeDeclarationSupportsBlobType() { public function testGetNativeDeclarationSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGBLOB'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGBLOB');
} }
public function testGetNativeDeclarationSupportsCharType() { public function testGetNativeDeclarationSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDeclarationSupportsVarcharType() { public function testGetNativeDeclarationSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(10)'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(10)');
} }
public function testGetNativeDeclarationSupportsArrayType() { public function testGetNativeDeclarationSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(40)'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(40)');
} }
public function testGetNativeDeclarationSupportsStringType() { public function testGetNativeDeclarationSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDeclarationSupportsStringTypeWithLongLength() { public function testGetNativeDeclarationSupportsStringTypeWithLongLength()
{
$a = array('type' => 'string', 'length' => 2000); $a = array('type' => 'string', 'length' => 2000);
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDeclarationSupportsArrayType2() { public function testGetNativeDeclarationSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDeclarationSupportsObjectType() { public function testGetNativeDeclarationSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() { public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try { try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail(); $this->fail();
...@@ -39,12 +40,14 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -39,12 +40,14 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->pass(); $this->pass();
} }
} }
public function testGetPortableDeclarationSupportsNativeFloatType() { public function testGetPortableDeclarationSupportsNativeFloatType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeIntegerTypes() { public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'integer')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'integer'));
$this->assertEqual($type, array(array('integer'), null, null, null)); $this->assertEqual($type, array(array('integer'), null, null, null));
...@@ -57,7 +60,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -57,7 +60,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null)); $this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
} }
public function testGetPortableDeclarationSupportsNativeStringTypes() { public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar'));
$this->assertEqual($type, array(array('string'), null, null, null)); $this->assertEqual($type, array(array('string'), null, null, null));
...@@ -78,7 +82,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -78,7 +82,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, true)); $this->assertEqual($type, array(array('string', 'boolean'), 1, null, true));
} }
public function testGetPortableDeclarationSupportsNativeNumberType() { public function testGetPortableDeclarationSupportsNativeNumberType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'number')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'number'));
$this->assertEqual($type, array(array('integer'), null, null, null)); $this->assertEqual($type, array(array('integer'), null, null, null));
...@@ -87,7 +92,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -87,7 +92,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null)); $this->assertEqual($type, array(array('integer', 'boolean'), 1, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimestampType() { public function testGetPortableDeclarationSupportsNativeTimestampType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
...@@ -96,7 +102,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -96,7 +102,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeClobTypes() { public function testGetPortableDeclarationSupportsNativeClobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'clob')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'clob'));
$this->assertEqual($type, array(array('clob'), null, null, null)); $this->assertEqual($type, array(array('clob'), null, null, null));
...@@ -110,7 +117,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -110,7 +117,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('clob'), null, null, null)); $this->assertEqual($type, array(array('clob'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeBlobTypes() { public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
...@@ -127,7 +135,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -127,7 +135,8 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(20)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(20)');
...@@ -141,67 +150,80 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { ...@@ -141,67 +150,80 @@ class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(2)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(2)');
} }
public function testGetNativeDefinitionSupportsFloatType() { public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER');
} }
public function testGetNativeDefinitionSupportsBooleanType() { public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(1)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(1)');
} }
public function testGetNativeDefinitionSupportsDateType() { public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsTimestampType() { public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsTimeType() { public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsClobType() { public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CLOB'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CLOB');
} }
public function testGetNativeDefinitionSupportsBlobType() { public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB');
} }
public function testGetNativeDefinitionSupportsCharType() { public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsVarcharType() { public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(10)');
} }
public function testGetNativeDefinitionSupportsArrayType() { public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(40)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(40)');
} }
public function testGetNativeDefinitionSupportsStringType() { public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
} }
public function testGetNativeDefinitionSupportsArrayType2() { public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
} }
public function testGetNativeDefinitionSupportsObjectType() { public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)');
......
...@@ -30,11 +30,14 @@ ...@@ -30,11 +30,14 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase
public function getDeclaration($type) { {
public function getDeclaration($type)
{
return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 2, 'fixed' => true)); return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 2, 'fixed' => true));
} }
public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() { public function testGetPortableDeclarationForUnknownNativeTypeThrowsException()
{
try { try {
$this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type'));
$this->fail(); $this->fail();
...@@ -42,7 +45,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -42,7 +45,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->pass(); $this->pass();
} }
} }
public function testGetPortableDeclarationSupportsNativeBlobTypes() { public function testGetPortableDeclarationSupportsNativeBlobTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob'));
$this->assertEqual($type, array(array('blob'), null, null, null)); $this->assertEqual($type, array(array('blob'), null, null, null));
...@@ -67,7 +71,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -67,7 +71,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('blob', 'clob'), null, null, null)); $this->assertEqual($type, array(array('blob', 'clob'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimestampTypes() { public function testGetPortableDeclarationSupportsNativeTimestampTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp'));
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
...@@ -76,7 +81,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -76,7 +81,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('timestamp'), null, null, null)); $this->assertEqual($type, array(array('timestamp'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDecimalTypes() { public function testGetPortableDeclarationSupportsNativeDecimalTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal'));
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
...@@ -89,7 +95,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -89,7 +95,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('decimal'), null, null, null)); $this->assertEqual($type, array(array('decimal'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeFloatTypes() { public function testGetPortableDeclarationSupportsNativeFloatTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'float'));
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
...@@ -102,22 +109,26 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -102,22 +109,26 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('float'), null, null, null)); $this->assertEqual($type, array(array('float'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeYearType() { public function testGetPortableDeclarationSupportsNativeYearType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'year')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'year'));
$this->assertEqual($type, array(array('integer', 'date'), null, null, null)); $this->assertEqual($type, array(array('integer', 'date'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeDateType() { public function testGetPortableDeclarationSupportsNativeDateType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'date'));
$this->assertEqual($type, array(array('date'), null, null, null)); $this->assertEqual($type, array(array('date'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeTimeType() { public function testGetPortableDeclarationSupportsNativeTimeType()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'time')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'time'));
$this->assertEqual($type, array(array('time'), null, null, null)); $this->assertEqual($type, array(array('time'), null, null, null));
} }
public function testGetPortableDeclarationSupportsNativeStringTypes() { public function testGetPortableDeclarationSupportsNativeStringTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'text'));
$this->assertEqual($type, array(array('string', 'clob'), null, null, null)); $this->assertEqual($type, array(array('string', 'clob'), null, null, null));
...@@ -138,7 +149,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -138,7 +149,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($type, array(array('string', 'boolean'), 1, null, true)); $this->assertEqual($type, array(array('string', 'boolean'), 1, null, true));
} }
public function testGetPortableDeclarationSupportsNativeIntegerTypes() { public function testGetPortableDeclarationSupportsNativeIntegerTypes()
{
$type = $this->dataDict->getPortableDeclaration(array('type' => 'smallint')); $type = $this->dataDict->getPortableDeclaration(array('type' => 'smallint'));
$this->assertEqual($this->getDeclaration('smallint'), array(array('integer', 'boolean'), 2, false, null)); $this->assertEqual($this->getDeclaration('smallint'), array(array('integer', 'boolean'), 2, false, null));
...@@ -155,12 +167,14 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -155,12 +167,14 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->getDeclaration('bigserial'), array(array('integer'), 8, false, null)); $this->assertEqual($this->getDeclaration('bigserial'), array(array('integer'), 8, false, null));
$this->assertEqual($this->getDeclaration('serial8'), array(array('integer'), 8, false, null)); $this->assertEqual($this->getDeclaration('serial8'), array(array('integer'), 8, false, null));
} }
public function testGetPortableDeclarationSupportsNativeBooleanTypes() { public function testGetPortableDeclarationSupportsNativeBooleanTypes()
{
$this->assertEqual($this->getDeclaration('bool'), array(array('boolean'), 1, false, null)); $this->assertEqual($this->getDeclaration('bool'), array(array('boolean'), 1, false, null));
$this->assertEqual($this->getDeclaration('boolean'), array(array('boolean'), 1, false, null)); $this->assertEqual($this->getDeclaration('boolean'), array(array('boolean'), 1, false, null));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
...@@ -173,7 +187,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -173,7 +187,8 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT');
} }
public function testGetNativeDefinitionSupportsIntegerTypeWithAutoinc() { public function testGetNativeDefinitionSupportsIntegerTypeWithAutoinc()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false, 'autoincrement' => true); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false, 'autoincrement' => true);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGSERIAL PRIMARY KEY'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGSERIAL PRIMARY KEY');
...@@ -186,67 +201,80 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase { ...@@ -186,67 +201,80 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SERIAL PRIMARY KEY'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SERIAL PRIMARY KEY');
} }
public function testGetNativeDefinitionSupportsFloatType() { public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT8'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT8');
} }
public function testGetNativeDefinitionSupportsBooleanType() { public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BOOLEAN'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BOOLEAN');
} }
public function testGetNativeDefinitionSupportsDateType() { public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsTimestampType() { public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP without time zone'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP without time zone');
} }
public function testGetNativeDefinitionSupportsTimeType() { public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME without time zone'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME without time zone');
} }
public function testGetNativeDefinitionSupportsClobType() { public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsBlobType() { public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BYTEA'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BYTEA');
} }
public function testGetNativeDefinitionSupportsCharType() { public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsVarcharType() { public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
} }
public function testGetNativeDefinitionSupportsArrayType() { public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
} }
public function testGetNativeDefinitionSupportsStringType() { public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsArrayType2() { public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsObjectType() { public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
......
<?php <?php
class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase { class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
public function testBooleanMapsToBooleanType() { public function testBooleanMapsToBooleanType()
{
$this->assertDeclarationType('boolean', 'boolean'); $this->assertDeclarationType('boolean', 'boolean');
} }
public function testIntegersMapToIntegerType() { public function testIntegersMapToIntegerType()
{
$this->assertDeclarationType('tinyint', array('integer', 'boolean')); $this->assertDeclarationType('tinyint', array('integer', 'boolean'));
$this->assertDeclarationType('smallint', 'integer'); $this->assertDeclarationType('smallint', 'integer');
$this->assertDeclarationType('mediumint', 'integer'); $this->assertDeclarationType('mediumint', 'integer');
...@@ -13,25 +15,30 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase { ...@@ -13,25 +15,30 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertDeclarationType('bigint', 'integer'); $this->assertDeclarationType('bigint', 'integer');
$this->assertDeclarationType('bigserial', 'integer'); $this->assertDeclarationType('bigserial', 'integer');
} }
public function testBlobsMapToBlobType( ){ public function testBlobsMapToBlobType()
{
$this->assertDeclarationType('tinyblob', 'blob'); $this->assertDeclarationType('tinyblob', 'blob');
$this->assertDeclarationType('mediumblob', 'blob'); $this->assertDeclarationType('mediumblob', 'blob');
$this->assertDeclarationType('longblob', 'blob'); $this->assertDeclarationType('longblob', 'blob');
$this->assertDeclarationType('blob', 'blob'); $this->assertDeclarationType('blob', 'blob');
} }
public function testDecimalMapsToDecimal() { public function testDecimalMapsToDecimal()
{
$this->assertDeclarationType('decimal', 'decimal'); $this->assertDeclarationType('decimal', 'decimal');
$this->assertDeclarationType('numeric', 'decimal'); $this->assertDeclarationType('numeric', 'decimal');
} }
public function testFloatRealAndDoubleMapToFloat() { public function testFloatRealAndDoubleMapToFloat()
{
$this->assertDeclarationType('float', 'float'); $this->assertDeclarationType('float', 'float');
$this->assertDeclarationType('double', 'float'); $this->assertDeclarationType('double', 'float');
$this->assertDeclarationType('real', 'float'); $this->assertDeclarationType('real', 'float');
} }
public function testYearMapsToIntegerAndDate() { public function testYearMapsToIntegerAndDate()
{
$this->assertDeclarationType('year', array('integer','date')); $this->assertDeclarationType('year', array('integer','date'));
} }
public function testGetNativeDefinitionSupportsIntegerType() { public function testGetNativeDefinitionSupportsIntegerType()
{
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false); $a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
...@@ -45,88 +52,82 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase { ...@@ -45,88 +52,82 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
} }
public function testGetNativeDefinitionSupportsFloatType() { public function testGetNativeDefinitionSupportsFloatType()
{
$a = array('type' => 'float', 'length' => 20, 'fixed' => false); $a = array('type' => 'float', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE');
} }
public function testGetNativeDefinitionSupportsBooleanType() { public function testGetNativeDefinitionSupportsBooleanType()
{
$a = array('type' => 'boolean', 'fixed' => false); $a = array('type' => 'boolean', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER');
} }
public function testGetNativeDefinitionSupportsDateType() { public function testGetNativeDefinitionSupportsDateType()
{
$a = array('type' => 'date', 'fixed' => false); $a = array('type' => 'date', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE');
} }
public function testGetNativeDefinitionSupportsTimestampType() { public function testGetNativeDefinitionSupportsTimestampType()
{
$a = array('type' => 'timestamp', 'fixed' => false); $a = array('type' => 'timestamp', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME');
} }
public function testGetNativeDefinitionSupportsTimeType() { public function testGetNativeDefinitionSupportsTimeType()
{
$a = array('type' => 'time', 'fixed' => false); $a = array('type' => 'time', 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME');
} }
public function testGetNativeDefinitionSupportsClobType() { public function testGetNativeDefinitionSupportsClobType()
{
$a = array('type' => 'clob'); $a = array('type' => 'clob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT');
} }
public function testGetNativeDefinitionSupportsBlobType() { public function testGetNativeDefinitionSupportsBlobType()
{
$a = array('type' => 'blob'); $a = array('type' => 'blob');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB');
} }
public function testGetNativeDefinitionSupportsCharType() { public function testGetNativeDefinitionSupportsCharType()
{
$a = array('type' => 'char', 'length' => 10); $a = array('type' => 'char', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)');
} }
public function testGetNativeDefinitionSupportsVarcharType() { public function testGetNativeDefinitionSupportsVarcharType()
{
$a = array('type' => 'varchar', 'length' => 10); $a = array('type' => 'varchar', 'length' => 10);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)');
} }
public function testGetNativeDefinitionSupportsArrayType() { public function testGetNativeDefinitionSupportsArrayType()
{
$a = array('type' => 'array', 'length' => 40); $a = array('type' => 'array', 'length' => 40);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)');
} }
public function testGetNativeDefinitionSupportsStringType() { public function testGetNativeDefinitionSupportsStringType()
{
$a = array('type' => 'string'); $a = array('type' => 'string');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsArrayType2() { public function testGetNativeDefinitionSupportsArrayType2()
{
$a = array('type' => 'array'); $a = array('type' => 'array');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT');
} }
public function testGetNativeDefinitionSupportsObjectType() { public function testGetNativeDefinitionSupportsObjectType()
{
$a = array('type' => 'object'); $a = array('type' => 'object');
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); $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