From b402d6ba8da5acbd4af37cfb3c0b36425d8d1e43 Mon Sep 17 00:00:00 2001 From: jackbravo Date: Mon, 10 Sep 2007 20:17:52 +0000 Subject: [PATCH] Corrected test case for ColumnAggregate field Object needs to be saved to set type column. Also deleted unnesesary model, test can be made with default models. --- models/InheritanceTest.php | 19 ------------------- .../ColumnAggregationInheritanceTestCase.php | 16 ++++++++-------- 2 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 models/InheritanceTest.php diff --git a/models/InheritanceTest.php b/models/InheritanceTest.php deleted file mode 100644 index c19d21d94..000000000 --- a/models/InheritanceTest.php +++ /dev/null @@ -1,19 +0,0 @@ -hasColumn('name', 'string'); - $this->hasColumn('type', 'string'); - - $this->setSubclasses(array('InheritanceChildTest' => array('type' => 'type 1'), - 'InheritanceChild2Test' => array('type' => 'type 2'))); - } -} - -class InheritanceChildTest extends InheritanceTest -{ } - -class InheritanceChild2Test extends InheritanceTest -{ } - diff --git a/tests/ColumnAggregationInheritanceTestCase.php b/tests/ColumnAggregationInheritanceTestCase.php index a794291ab..7c0134601 100644 --- a/tests/ColumnAggregationInheritanceTestCase.php +++ b/tests/ColumnAggregationInheritanceTestCase.php @@ -35,8 +35,8 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa { protected $otherEntity = null; - public function prepareData() - { + public function prepareData() + { parent::prepareData(); //we create a test entity that is not a user and not a group $entity = new Entity(); @@ -66,17 +66,17 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa public function testStringColumnInheritance() { $q = new Doctrine_Query(); - - $q->from('InheritanceChildTest'); - - $this->assertEqual($q->getSql(), "SELECT i.id AS i__id, i.name AS i__name, i.type AS i__type FROM inheritance_test i WHERE (i.type = 'type 1')"); + $q->select('g.name')->from('Group g'); + $this->assertEqual($q->getSql(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 1)"); } public function testSubclassFieldSetWhenCreatingNewSubclassedRecord() { - $child = new InheritanceChildTest(); + $child = new User(); + $child->name = 'Pedro'; $this->assertTrue(isset($child->type)); - $this->assertEqual('type 1', $child->type); + $child->save(); + $this->assertEqual($child->type, '0'); } }