Phactory\Sql\PhactoryTest::testCreateWithAssociations PHP Method

testCreateWithAssociations() public method

    public function testCreateWithAssociations()
    {
        $this->phactory->define('role', array('name' => 'admin'));
        $this->phactory->define('user', array('name' => 'testuser'), array('role' => $this->phactory->manyToOne('role', 'role_id')));
        $role = $this->phactory->create('role');
        $user = $this->phactory->createWithAssociations('user', array('role' => $role));
        $this->assertNotNull($role->id);
        $this->assertEquals($role->id, $user->role_id);
    }