public function ArrayCollectionTest::testRemoveElement 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::testRemoveElement()
File
- vendor/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 189
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testRemoveElement() {
$elements = array(
1,
'A' => 'a',
2,
'B' => 'b',
3,
'A2' => 'a',
'B2' => 'b',
);
$collection = new ArrayCollection($elements);
$this
->assertTrue($collection
->removeElement(1));
unset($elements[0]);
$this
->assertFalse($collection
->removeElement('non-existent'));
$this
->assertTrue($collection
->removeElement('a'));
unset($elements['A']);
$this
->assertTrue($collection
->removeElement('a'));
unset($elements['A2']);
$this
->assertEquals($elements, $collection
->toArray());
}