/**
  * Setup method
  */
 public function setUp()
 {
     with($conn = \rdbms\DriverManager::getConnection('mock://mock/JOBS?autoconnect=1'));
     Job::getPeer()->setConnection($conn);
     Person::getPeer()->setConnection($conn);
     $this->qa = new SelectQuery();
     $this->qa->setPeer(Job::getPeer());
     $this->qa->setCriteria(create(new Criteria(Job::column('job_id')->equal(5)))->setProjection(\rdbms\criterion\Projections::ProjectionList()->add(Job::column('job_id'))->add(Job::column('title'))));
     $this->qb = new SelectQuery();
     $this->qb->setPeer(Person::getPeer());
     $this->qb->setCriteria(create(new Criteria())->setProjection(\rdbms\criterion\Projections::ProjectionList()->add(Person::column('job_id'))->add(Person::column('name'))));
 }
 public function extractTest()
 {
     $toJob = new JoinPart('j', Job::getPeer());
     $toPerson = new JoinPart('p', Person::getPeer());
     $toDepartment = new JoinPart('d', Department::getPeer());
     $toChief = new JoinPart('c', Person::getPeer());
     $toJob->addRelative($toPerson, 'JobPerson');
     $toPerson->addRelative($toDepartment, 'Department');
     $toDepartment->addRelative($toChief, 'DepartmentChief');
     $job = Job::getPeer()->objectFor(array('job_id' => '21', 'title' => 'clean the toilette', 'valid_from' => new \util\Date(), 'expire_at' => ''));
     $toPerson->extract($job, array('p_person_id' => '11', 'p_name' => 'Schultz', 'p_job_id' => '21', 'p_department_id' => '31', 'd_department_id' => '31', 'd_name' => 'iDev', 'd_chief_id' => '12', 'c_person_id' => '12', 'c_name' => 'Friebe', 'c_job_id' => '22', 'c_department_id' => '31'), 'JobPerson');
     $this->assertClass($job->getCachedObj('JobPerson', '#11'), 'net.xp_framework.unittest.rdbms.dataset.Person');
     $this->assertClass($job->getCachedObj('JobPerson', '#11')->getCachedObj('Department', '#31'), 'net.xp_framework.unittest.rdbms.dataset.Department');
     $this->assertClass($job->getCachedObj('JobPerson', '#11')->getCachedObj('Department', '#31')->getCachedObj('DepartmentChief', '#12'), 'net.xp_framework.unittest.rdbms.dataset.Person');
 }