Example #1
0
 public function testRegisterAliasSecondLevel()
 {
     list($baseTree, $baseRefs) = $this->getSinisterAliasesBaseForRegister();
     $this->query->setAliasesTree($baseTree);
     $this->query->setAliasesReferences($baseRefs);
     $employee_joins = array('person' => array('select' => array('firstname', 'name'), 'on' => array('[person].id = [employee].person_id')), 'client' => array('on' => array('[client].id = [employee].client_id')));
     $person_joins = array();
     $result_person = $baseTree;
     $result_person['e']['children']['p'] = array('table' => 'person', 'type' => 'one', 'children' => array());
     $this->query->registerAlias('e', 'p', 'person', $employee_joins, $person_joins, 'person');
     $result = $this->query->getAliasesTree();
     unset($result['e']['children']['p']['parent']);
     // obligé de virer ce champ car sinon PHPUnit n'arrive pas à comparer car trop de récursion
     $this->assertEquals($result, $result_person);
 }