public function ArrayCollectionTest::testGet 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::testGet()
File
- vendor/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 263
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testGet() {
$elements = array(
1,
'A' => 'a',
2,
'null' => null,
3,
'A2' => 'a',
'zero' => 0,
);
$collection = new ArrayCollection($elements);
$this
->assertSame(2, $collection
->get(1), 'Get element by index');
$this
->assertSame('a', $collection
->get('A'), 'Get element by name');
$this
->assertSame(null, $collection
->get('non-existent'), 'Get non existent element');
}