Пример #1
0
 public function testRemove()
 {
     $elements = [1, 'A' => 'a', 2, 'B' => 'b', 3];
     $collection = new ArrayCollection($elements);
     $this->assertSame(1, $collection->remove(0));
     unset($elements[0]);
     $this->assertSame(null, $collection->remove('non-existent'));
     unset($elements['non-existent']);
     $this->assertSame(2, $collection->remove(1));
     unset($elements[1]);
     $this->assertSame('a', $collection->remove('A'));
     unset($elements['A']);
     $this->assertSame($elements, $collection->toArray());
 }