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

testOneToManyViaPropertySetting() public method

    public function testOneToManyViaPropertySetting()
    {
        $hero = new Hero(array('alias' => 'Spider Man'));
        $hero->save();
        $this->assertEquals(count($hero->Powers), 0);
        // save via property access
        $power = new Power(array('description' => 'Spider Senses'));
        $power->heroid = $hero->id;
        $power->save();
        $this->assertEquals(count($hero->Powers), 1);
        $this->assertTrue($hero->Powers[0]->equals($power));
    }