From 703fd8eb7f635a384f3d65e2579427731e7a55cc Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 14 Aug 2007 20:05:15 +0000 Subject: [PATCH] --- tests/OneTableOneClassInheritanceTestCase.php | 62 +++++++++++++++++++ tests/Query/SelectExpressionTestCase.php | 9 ++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tests/OneTableOneClassInheritanceTestCase.php diff --git a/tests/OneTableOneClassInheritanceTestCase.php b/tests/OneTableOneClassInheritanceTestCase.php new file mode 100644 index 000000000..3dc5be8bd --- /dev/null +++ b/tests/OneTableOneClassInheritanceTestCase.php @@ -0,0 +1,62 @@ +. + */ + +/** + * Doctrine_OneTableOneClassInheritance_TestCase + * + * @package Doctrine + * @author Bjarte Stien Karlsen + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + */ +class Doctrine_OneTableOneClassInheritance_TestCase extends Doctrine_UnitTestCase +{ + public function prepareData() + { } + public function prepareTables() + { } + public function testTableExporting() + { + $sql = $this->conn->export->exportClassesSql(array('ConcreteInheritanceTestParent', + 'ConcreteInheritanceTestChild')); + $this->assertEqual($sql[0], 'CREATE TABLE concrete_inheritance_test_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(2147483647))'); + $this->assertEqual($sql[1], 'CREATE TABLE concrete_inheritance_test_child (id INTEGER PRIMARY KEY AUTOINCREMENT, age INTEGER, name VARCHAR(2147483647))'); + } +} +class ConcreteInheritanceTestParent extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('name', 'string'); + } +} +class ConcreteInheritanceTestChild extends ConcreteInheritanceTestParent +{ + public function setTableDefinition() + { + $this->hasColumn('age', 'integer'); + + parent::setTableDefinition(); + } +} diff --git a/tests/Query/SelectExpressionTestCase.php b/tests/Query/SelectExpressionTestCase.php index 1219baf83..84e5f9ca7 100644 --- a/tests/Query/SelectExpressionTestCase.php +++ b/tests/Query/SelectExpressionTestCase.php @@ -33,6 +33,13 @@ */ class Doctrine_Query_SelectExpression_TestCase extends Doctrine_UnitTestCase { + public function prepareData() + { } + public function prepareTables() + { + $this->tables = array('User'); + parent::prepareTables(); + } public function testAdditionExpression() { $query = new Doctrine_Query(); @@ -98,4 +105,4 @@ class Doctrine_Query_SelectExpression_TestCase extends Doctrine_UnitTestCase $this->fail(); } } -} \ No newline at end of file +}