public function ArrayCollectionTest::testContainsKey in Plug 7
File
- lib/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 208
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testContainsKey() {
$elements = array(
1,
'A' => 'a',
2,
'null' => null,
3,
'A2' => 'a',
'B2' => 'b',
);
$collection = new ArrayCollection($elements);
$this
->assertTrue($collection
->containsKey(0), "Contains index 0");
$this
->assertTrue($collection
->containsKey('A'), "Contains key \"A\"");
$this
->assertTrue($collection
->containsKey('null'), "Contains key \"null\", with value null");
$this
->assertFalse($collection
->containsKey('non-existent'), "Doesn't contain key");
}