Commit 174b507d authored by gnat's avatar gnat

added new relation save test

parent 19de41b1
...@@ -36,17 +36,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase ...@@ -36,17 +36,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
{ } { }
public function prepareTables() public function prepareTables()
{ {
$this->tables = array('Record_City', 'Record_Country', 'SelfRefTest'); $this->tables = array('gnatUser','Email','Entity','Record_City', 'Record_Country', 'SelfRefTest');
parent::prepareTables(); parent::prepareTables();
} }
public function testOneToOneAggregateRelationWithAliasesIsSupported()
public function testOneToOneAggregateRelationWithAliasesIsSupported()
{ {
$city = new Record_City(); $city = new Record_City();
$country = $city->Country; $country = $city->Country;
$this->assertTrue($country instanceof Record_Country); $this->assertTrue($country instanceof Record_Country);
} }
public function testSelfReferentialOneToOneRelationsAreSupported() public function testSelfReferentialOneToOneRelationsAreSupported()
{ {
$ref = new SelfRefTest(); $ref = new SelfRefTest();
...@@ -83,4 +85,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase ...@@ -83,4 +85,19 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
$user->save(); $user->save();
$this->assertTrue($user->Email instanceOf Doctrine_Null); $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);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment