public function ArrayCollectionTest::testContains in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php \Doctrine\Tests\Common\Collections\ArrayCollectionTest::testContains()
File
- vendor/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 228
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testContains() {
$elements = array(
1,
'A' => 'a',
2,
'null' => null,
3,
'A2' => 'a',
'zero' => 0,
);
$collection = new ArrayCollection($elements);
$this
->assertTrue($collection
->contains(0), "Contains Zero");
$this
->assertTrue($collection
->contains('a'), "Contains \"a\"");
$this
->assertTrue($collection
->contains(null), "Contains Null");
$this
->assertFalse($collection
->contains('non-existent'), "Doesn't contain an element");
}