Пример #1
0
 public function testIndexOf()
 {
     $elements = [1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0];
     $collection = new ArrayCollection($elements);
     $this->assertSame(array_search(2, $elements, true), $collection->indexOf(2), 'Index of 2');
     $this->assertSame(array_search(null, $elements, true), $collection->indexOf(null), 'Index of null');
     $this->assertSame(array_search('non-existent', $elements, true), $collection->indexOf('non-existent'), 'Index of non existent');
 }