public function testMergeGroupBy()
 {
     $this->queryBuilder->groupBy('id');
     $qb = new SelectQueryBuilder();
     $qb->groupBy('score', SelectQueryBuilder::ASC);
     $this->queryBuilder->mergeGroupBy($qb);
     $expected = array(array('column' => 'id', 'order' => NULL), array('column' => 'score', 'order' => SelectQueryBuilder::ASC));
     $this->assertEquals($expected, $this->queryBuilder->getGroupByParts());
 }
Ejemplo n.º 2
0
 /**
  * Merges the given QueryBuilder's GROUP BYs into this QueryBuilder.
  *
  * @param \SQL\SelectQueryBuilder $QueryBuilder to merge
  *
  * @return \SQL\SelectQueryBuilder the current QueryBuilder
  */
 public function mergeGroupBy(SelectQueryBuilder $QueryBuilder)
 {
     foreach ($QueryBuilder->getGroupByParts() as $currentGroupBy) {
         $this->groupBy($currentGroupBy['column'], $currentGroupBy['order']);
     }
     return $this;
 }