/**
  * Tests that an ORDER BY is only added if a LIMIT is set.
  */
 public function testAggregateNoOrderByIfNoLimit()
 {
     $query = new SQLSelect();
     $query->setFrom('"SQLSelectTest_DO"');
     $query->setOrderBy('Common');
     $query->setLimit(array());
     $aggregate = $query->aggregate('MAX("ID")');
     $limit = $aggregate->getLimit();
     $this->assertEquals(array(), $aggregate->getOrderBy());
     $this->assertEquals(array(), $limit);
     $query = new SQLSelect();
     $query->setFrom('"SQLSelectTest_DO"');
     $query->setOrderBy('Common');
     $query->setLimit(2);
     $aggregate = $query->aggregate('MAX("ID")');
     $limit = $aggregate->getLimit();
     $this->assertEquals(array('Common' => 'ASC'), $aggregate->getOrderBy());
     $this->assertEquals(array('start' => 0, 'limit' => 2), $limit);
 }