From a4cab6ae914d7073d38449e0241478c611a0ad1a Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 28 Nov 2006 17:56:51 +0000 Subject: [PATCH] added missing test cases --- tests/Connection/MysqlTestCase.php | 10 ++++ tests/DataDict/Firebird.php | 85 +++++++++++++++++++++++++++++ tests/DataDict/InformixTestCase.php | 7 +++ tests/DataDict/MssqlTestCase.php | 85 +++++++++++++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 tests/Connection/MysqlTestCase.php create mode 100644 tests/DataDict/Firebird.php create mode 100644 tests/DataDict/InformixTestCase.php create mode 100644 tests/DataDict/MssqlTestCase.php diff --git a/tests/Connection/MysqlTestCase.php b/tests/Connection/MysqlTestCase.php new file mode 100644 index 000000000..140f08067 --- /dev/null +++ b/tests/Connection/MysqlTestCase.php @@ -0,0 +1,10 @@ +conn->quoteIdentifier('identifier', false); + $this->assertEqual($id, '`identifier`'); + } +} diff --git a/tests/DataDict/Firebird.php b/tests/DataDict/Firebird.php new file mode 100644 index 000000000..036322aa8 --- /dev/null +++ b/tests/DataDict/Firebird.php @@ -0,0 +1,85 @@ + 'integer', 'length' => 20, 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); + + $a['length'] = 4; + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); + + $a['length'] = 2; + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); + } + + public function testGetNativeDefinitionSupportsFloatType() { + $a = array('type' => 'float', 'length' => 20, 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE'); + } + public function testGetNativeDefinitionSupportsBooleanType() { + $a = array('type' => 'boolean', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TINYINT(1)'); + } + public function testGetNativeDefinitionSupportsDateType() { + $a = array('type' => 'date', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); + } + public function testGetNativeDefinitionSupportsTimestampType() { + $a = array('type' => 'timestamp', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME'); + } + public function testGetNativeDefinitionSupportsTimeType() { + $a = array('type' => 'time', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); + } + public function testGetNativeDefinitionSupportsClobType() { + $a = array('type' => 'clob'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT'); + } + public function testGetNativeDefinitionSupportsBlobType() { + $a = array('type' => 'blob'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB'); + } + public function testGetNativeDefinitionSupportsCharType() { + $a = array('type' => 'char', 'length' => 10); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); + } + public function testGetNativeDefinitionSupportsVarcharType() { + $a = array('type' => 'varchar', 'length' => 10); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); + } + public function testGetNativeDefinitionSupportsArrayType() { + $a = array('type' => 'array', 'length' => 40); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); + } + public function testGetNativeDefinitionSupportsStringType() { + $a = array('type' => 'string'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } + public function testGetNativeDefinitionSupportsArrayType2() { + $a = array('type' => 'array'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } + public function testGetNativeDefinitionSupportsObjectType() { + $a = array('type' => 'object'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } +} diff --git a/tests/DataDict/InformixTestCase.php b/tests/DataDict/InformixTestCase.php new file mode 100644 index 000000000..7fa494e6a --- /dev/null +++ b/tests/DataDict/InformixTestCase.php @@ -0,0 +1,7 @@ + 'integer', 'length' => 20, 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); + + $a['length'] = 4; + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); + + $a['length'] = 2; + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); + } + + public function testGetNativeDefinitionSupportsFloatType() { + $a = array('type' => 'float', 'length' => 20, 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE'); + } + public function testGetNativeDefinitionSupportsBooleanType() { + $a = array('type' => 'boolean', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TINYINT(1)'); + } + public function testGetNativeDefinitionSupportsDateType() { + $a = array('type' => 'date', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); + } + public function testGetNativeDefinitionSupportsTimestampType() { + $a = array('type' => 'timestamp', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME'); + } + public function testGetNativeDefinitionSupportsTimeType() { + $a = array('type' => 'time', 'fixed' => false); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); + } + public function testGetNativeDefinitionSupportsClobType() { + $a = array('type' => 'clob'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT'); + } + public function testGetNativeDefinitionSupportsBlobType() { + $a = array('type' => 'blob'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB'); + } + public function testGetNativeDefinitionSupportsCharType() { + $a = array('type' => 'char', 'length' => 10); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); + } + public function testGetNativeDefinitionSupportsVarcharType() { + $a = array('type' => 'varchar', 'length' => 10); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); + } + public function testGetNativeDefinitionSupportsArrayType() { + $a = array('type' => 'array', 'length' => 40); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); + } + public function testGetNativeDefinitionSupportsStringType() { + $a = array('type' => 'string'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } + public function testGetNativeDefinitionSupportsArrayType2() { + $a = array('type' => 'array'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } + public function testGetNativeDefinitionSupportsObjectType() { + $a = array('type' => 'object'); + + $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); + } +}