added test to ensure that a link to a hasOne resource can be unset
This commit is contained in:
parent
86af4c771b
commit
f92cd7771b
@ -69,4 +69,18 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
|
|||||||
$this->assertEqual($ref->name, 'ref 1');
|
$this->assertEqual($ref->name, 'ref 1');
|
||||||
$this->assertEqual($ref->createdBy->name, 'ref 2');
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user