public function multipleJoinResultTest()
 {
     $rs = new MockResultSet(array(array(JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Schultz', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '21', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '12', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Müller', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '12', JoinProcessor::FIRST . '_title' => 'second job', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Schultz', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '21', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '13', JoinProcessor::FIRST . '_title' => 'third job', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => null, JoinProcessor::pathToKey(array('PersonJob')) . '_name' => null, JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => null, JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => null)));
     $jp = new JoinProcessor(Job::getPeer());
     $jp->setFetchModes(array('PersonJob' => 'join'));
     $ji = new JoinIterator($jp, $rs);
     $this->assertTrue($ji->hasNext());
     $this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
     $this->assertArray($job->getPersonJobList());
     $this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
     $this->assertTrue($pji->hasNext());
     $this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
     $this->assertTrue($pji->hasNext());
     $this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
     $this->assertFalse($pji->hasNext());
     $this->assertTrue($ji->hasNext());
     $this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
     $this->assertArray($job->getPersonJobList());
     $this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
     $this->assertTrue($pji->hasNext());
     $this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
     $this->assertFalse($pji->hasNext());
     $this->assertTrue($ji->hasNext());
     $this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
     $this->assertArray($job->getPersonJobList());
     $this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
     $this->assertFalse($pji->hasNext());
     $this->assertFalse($ji->hasNext());
 }
예제 #2
0
 public function multipleJoinResultTest()
 {
     $rs = new MockResultSet([[JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(['PersonJob']) . '_person_id' => '11', JoinProcessor::pathToKey(['PersonJob']) . '_name' => 'Schultz', JoinProcessor::pathToKey(['PersonJob']) . '_job_id' => '21', JoinProcessor::pathToKey(['PersonJob']) . '_department_id' => '31'], [JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(['PersonJob']) . '_person_id' => '12', JoinProcessor::pathToKey(['PersonJob']) . '_name' => 'Müller', JoinProcessor::pathToKey(['PersonJob']) . '_job_id' => '11', JoinProcessor::pathToKey(['PersonJob']) . '_department_id' => '31'], [JoinProcessor::FIRST . '_job_id' => '12', JoinProcessor::FIRST . '_title' => 'second job', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(['PersonJob']) . '_person_id' => '11', JoinProcessor::pathToKey(['PersonJob']) . '_name' => 'Schultz', JoinProcessor::pathToKey(['PersonJob']) . '_job_id' => '21', JoinProcessor::pathToKey(['PersonJob']) . '_department_id' => '31'], [JoinProcessor::FIRST . '_job_id' => '13', JoinProcessor::FIRST . '_title' => 'third job', JoinProcessor::FIRST . '_valid_from' => new \util\Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(['PersonJob']) . '_person_id' => null, JoinProcessor::pathToKey(['PersonJob']) . '_name' => null, JoinProcessor::pathToKey(['PersonJob']) . '_job_id' => null, JoinProcessor::pathToKey(['PersonJob']) . '_department_id' => null]]);
     $jp = new JoinProcessor(Job::getPeer());
     $jp->setFetchModes(['PersonJob' => 'join']);
     $ji = new JoinIterator($jp, $rs);
     $this->assertTrue($ji->hasNext());
     $this->assertInstanceOf(Job::class, $job = $ji->next());
     $this->assertInstanceOf('var[]', $job->getPersonJobList());
     $this->assertInstanceOf(CachedResults::class, $pji = $job->getPersonJobIterator());
     $this->assertTrue($pji->hasNext());
     $this->assertInstanceOf(Person::class, $pji->next());
     $this->assertTrue($pji->hasNext());
     $this->assertInstanceOf(Person::class, $pji->next());
     $this->assertFalse($pji->hasNext());
     $this->assertTrue($ji->hasNext());
     $this->assertInstanceOf(Job::class, $job = $ji->next());
     $this->assertInstanceOf('var[]', $job->getPersonJobList());
     $this->assertInstanceOf(CachedResults::class, $pji = $job->getPersonJobIterator());
     $this->assertTrue($pji->hasNext());
     $this->assertInstanceOf(Person::class, $pji->next());
     $this->assertFalse($pji->hasNext());
     $this->assertTrue($ji->hasNext());
     $this->assertInstanceOf(Job::class, $job = $ji->next());
     $this->assertInstanceOf('var[]', $job->getPersonJobList());
     $this->assertInstanceOf(CachedResults::class, $pji = $job->getPersonJobIterator());
     $this->assertFalse($pji->hasNext());
     $this->assertFalse($ji->hasNext());
 }