From 174b507debcd52fee95f32755a3229626e1f81b8 Mon Sep 17 00:00:00 2001 From: gnat Date: Wed, 19 Sep 2007 21:25:14 +0000 Subject: [PATCH] added new relation save test --- tests/Relation/OneToOneTestCase.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/Relation/OneToOneTestCase.php b/tests/Relation/OneToOneTestCase.php index 2f37dc373..fef74f449 100644 --- a/tests/Relation/OneToOneTestCase.php +++ b/tests/Relation/OneToOneTestCase.php @@ -36,17 +36,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase { } public function prepareTables() { - $this->tables = array('Record_City', 'Record_Country', 'SelfRefTest'); + $this->tables = array('gnatUser','Email','Entity','Record_City', 'Record_Country', 'SelfRefTest'); parent::prepareTables(); } - public function testOneToOneAggregateRelationWithAliasesIsSupported() + + public function testOneToOneAggregateRelationWithAliasesIsSupported() { $city = new Record_City(); $country = $city->Country; $this->assertTrue($country instanceof Record_Country); } + public function testSelfReferentialOneToOneRelationsAreSupported() { $ref = new SelfRefTest(); @@ -83,4 +85,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase $user->save(); $this->assertTrue($user->Email instanceOf Doctrine_Null); } + + public function testSavingRelatedObjects() + { + $user = new gnatUser(); + $user->name = "test"; + $email = new Email(); + $email->address = "test@test.com"; + $user->Email = $email; + $user->save(); + $this->assertTrue($user->Email instanceOf Email); + $this->assertTrue($user->email_id != 0); + $this->assertTrue($user->email_id != null); + $this->assertTrue($user->email_id == $user->Email->id); + + } }