Exemplo n.º 1
0
 /**
  * Test sorting collection by callback and retaining element keys/indicies
  *
  * @return void
  */
 public function testAsort()
 {
     $this->collection->asort(function ($a, $b) {
         if ($a === $b) {
             return 0;
         }
         return $a > $b ? -1 : 1;
     });
     $this->assertAttributeEquals([2 => 3, 1 => 2, 0 => 1], 'elements', $this->collection);
 }