Пример #1
0
 public function testExists()
 {
     $elements = [1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0];
     $collection = new ArrayCollection($elements);
     $this->assertTrue($collection->exists(function ($key, $element) {
         return $key === 'A' && $element === 'a';
     }), 'Element exists');
     $this->assertFalse($collection->exists(function ($key, $element) {
         return $key === 'non-existent' && $element === 'non-existent';
     }), 'Element not exists');
 }