public function testDirection()
 {
     $col = new Column("date_created", "project");
     $order = new OrderBy($col, OrderBy::ASC, false);
     $order->setDirection(OrderBy::DESC);
     $this->assertEquals(OrderBy::DESC, $order->getDirection());
     $this->setExpectedException("InvalidArgumentException");
     $order->setDirection("this is not a valid direction");
 }
예제 #2
0
 /**
  * @param OrderBy $orderBy
  * @return string
  */
 protected function _renderOrderBy(OrderBy $orderBy)
 {
     if (($alias = $orderBy->getColumn()->getAlias()) && $orderBy->getUseAlias()) {
         $col = $this->_renderAlias($alias);
     } else {
         $col = $this->_renderColumn($orderBy->getColumn());
     }
     return $col . ' ' . $orderBy->getDirection();
 }