예제 #1
0
 /** @test */
 public function should_sort_items_in_collection_and_reset_keys()
 {
     $this->collection->sort(function ($a, $b) {
         if ($a == $b) {
             return 0;
         }
         return $a < $b ? -1 : 1;
     });
     $this->collection->values();
     $this->assertEquals('Bart', $this->collection->get(0));
     $this->assertEquals('Homer', $this->collection->get(1));
     $this->assertEquals('Lisa', $this->collection->get(2));
     $this->assertEquals('Maggie', $this->collection->get(3));
     $this->assertEquals('Marge', $this->collection->get(4));
 }