1
0
mirror of synced 2024-12-14 15:16:04 +03:00
doctrine2/tests/DataDict/MysqlTestCase.php

90 lines
3.5 KiB
PHP
Raw Normal View History

2006-11-28 00:59:22 +03:00
<?php
class Doctrine_DataDict_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('mysql');
2006-11-30 17:40:50 +03:00
}
public function testGetPortableDefinitionSupportsIntegers() {
$field = array('INT UNSIGNED');
2006-11-28 00:59:22 +03:00
}
public function testGetNativeDefinitionSupportsIntegerType() {
$a = array('type' => 'integer', 'length' => 20, 'fixed' => false);
$this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT');
$a['length'] = 4;
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'INT');
2006-11-28 00:59:22 +03:00
$a['length'] = 2;
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'SMALLINT');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsFloatType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'float', 'length' => 20, 'fixed' => false);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DOUBLE');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsBooleanType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'boolean', 'fixed' => false);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TINYINT(1)');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsDateType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'date', 'fixed' => false);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATE');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsTimestampType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'timestamp', 'fixed' => false);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATETIME');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsTimeType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'time', 'fixed' => false);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TIME');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsClobType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'clob');
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGTEXT');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsBlobType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'blob');
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGBLOB');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsCharType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'char', 'length' => 10);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'CHAR(10)');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsVarcharType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'varchar', 'length' => 10);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(10)');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsArrayType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'array', 'length' => 40);
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(40)');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsStringType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'string');
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsArrayType2() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'array');
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
2006-11-28 00:59:22 +03:00
}
2006-11-30 17:40:50 +03:00
public function testGetNativeDeclarationSupportsObjectType() {
2006-11-28 00:59:22 +03:00
$a = array('type' => 'object');
2006-11-30 17:40:50 +03:00
$this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT');
2006-11-28 00:59:22 +03:00
}
}