public function ArrayCollectionTest::testRemove in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php \Doctrine\Tests\Common\Collections\ArrayCollectionTest::testRemove()
File
- vendor/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 169
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testRemove() {
$elements = array(
1,
'A' => 'a',
2,
'B' => 'b',
3,
);
$collection = new ArrayCollection($elements);
$this
->assertEquals(1, $collection
->remove(0));
unset($elements[0]);
$this
->assertEquals(null, $collection
->remove('non-existent'));
unset($elements['non-existent']);
$this
->assertEquals(2, $collection
->remove(1));
unset($elements[1]);
$this
->assertEquals('a', $collection
->remove('A'));
unset($elements['A']);
$this
->assertEquals($elements, $collection
->toArray());
}