Example #1
0
 function testIntegratedQuerySort()
 {
     $numbers = new qinq\Collection(range(1, 3));
     $matches = range(3, 1);
     foreach ($numbers->sort(qinq\Order::DESCENDING) as $number) {
         $match = array_shift($matches);
         $this->assertEquals($match, $number);
     }
     $matches = range(3, 1);
     foreach ($numbers->sort(function ($a, $b) {
         return $a > $b ? -1 : 1;
     }) as $number) {
         $match = array_shift($matches);
         $this->assertEquals($match, $number);
     }
 }