Esempio n. 1
0
 public function testHasKey()
 {
     $items = $this->createRandomItems();
     $items_count = count($items);
     $last_index = $items_count - 1;
     // pick a random item from the list to test against
     $random_key = 0;
     if ($last_index > 0) {
         $random_key = self::$faker->numberBetween(0, $last_index);
     }
     $list = new ArrayList($items);
     $this->assertEquals(true, $list->hasKey($random_key));
     $this->assertEquals(false, $list->hasKey($items_count + 1));
 }