1
0
mirror of synced 2024-12-13 22:56:04 +03:00

added new relation save test

This commit is contained in:
gnat 2007-09-19 21:25:14 +00:00
parent 19de41b1bf
commit 174b507deb

View File

@ -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);
}
}