/**
  * Get the effective order vector.
  *
  * @return PhabricatorQueryOrderVector Effective vector.
  * @task order
  */
 protected function getOrderVector()
 {
     if (!$this->orderVector) {
         if ($this->builtinOrder !== null) {
             $builtin_order = idx($this->getBuiltinOrders(), $this->builtinOrder);
             $vector = $builtin_order['vector'];
         } else {
             $vector = $this->getDefaultOrderVector();
         }
         if ($this->groupVector) {
             $group = PhabricatorQueryOrderVector::newFromVector($this->groupVector);
             $group->appendVector($vector);
             $vector = $group;
         }
         $vector = PhabricatorQueryOrderVector::newFromVector($vector);
         // We call setOrderVector() here to apply checks to the default vector.
         // This catches any errors in the implementation.
         $this->setOrderVector($vector);
     }
     return $this->orderVector;
 }
 public function testQueryOrderVector()
 {
     $vector = PhabricatorQueryOrderVector::newFromVector(array('a', 'b', '-c', 'd'));
     $this->assertEqual(array('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd'), mpull(iterator_to_array($vector), 'getOrderKey'));
     $this->assertEqual(array('a' => false, 'b' => false, 'c' => true, 'd' => false), mpull(iterator_to_array($vector), 'getIsReversed'));
 }