Pheasant\Tests\Relationships\RelationshipTest::testHasOneRelationship PHP Method

testHasOneRelationship() public method

    public function testHasOneRelationship()
    {
        $hero = new Hero(array('alias' => 'Spider Man'));
        $hero->save();
        $identity = new SecretIdentity(array('realname' => 'Peter Parker'));
        $identity->Hero = $hero;
        $identity->save();
        $this->assertEquals($hero->identityid, $identity->id);
        $this->assertTrue($hero->SecretIdentity->equals($identity));
        $this->assertTrue($identity->Hero->equals($hero));
    }