public function testBuildWithAssociations() { Phactory::define('role', array('name' => 'admin')); Phactory::define('user', array('name' => 'testuser'), array('role' => Phactory::manyToOne('role', 'role_id'))); $role = Phactory::create('role'); $user = Phactory::buildWithAssociations('user', array('role' => $role)); $this->assertNotNull($role->id); $this->assertEquals($role->id, $user->role_id); }