public function CollectionTest::testExists

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php, line 40

Class

CollectionTest

Namespace

Doctrine\Tests\Common\Collections

Code

public function testExists() {
  $this->_coll
    ->add("one");
  $this->_coll
    ->add("two");
  $exists = $this->_coll
    ->exists(function ($k, $e) {
    return $e == "one";
  });
  $this
    ->assertTrue($exists);
  $exists = $this->_coll
    ->exists(function ($k, $e) {
    return $e == "other";
  });
  $this
    ->assertFalse($exists);
}