From f92cd7771b53057c37e280ad223eaac906556faa Mon Sep 17 00:00:00 2001 From: meus Date: Sat, 11 Aug 2007 16:23:59 +0000 Subject: [PATCH] added test to ensure that a link to a hasOne resource can be unset --- tests/Relation/OneToOneTestCase.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Relation/OneToOneTestCase.php b/tests/Relation/OneToOneTestCase.php index 28e7950af..2f37dc373 100644 --- a/tests/Relation/OneToOneTestCase.php +++ b/tests/Relation/OneToOneTestCase.php @@ -69,4 +69,18 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase $this->assertEqual($ref->name, 'ref 1'); $this->assertEqual($ref->createdBy->name, 'ref 2'); } + + public function testUnsetRelation() + { + $user = new User(); + $user->name = "test"; + $email = new Email(); + $email->address = "test@test.com"; + $user->Email = $email; + $user->save(); + $this->assertTrue($user->Email instanceOf Email); + $user->Email = Email::getNullObject(); + $user->save(); + $this->assertTrue($user->Email instanceOf Doctrine_Null); + } }