You are here

public function CollectionTest::testFilter in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php \Doctrine\Tests\Common\Collections\CollectionTest::testFilter()

File

vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php, line 59

Class

CollectionTest

Namespace

Doctrine\Tests\Common\Collections

Code

public function testFilter() {
  $this->collection
    ->add(1);
  $this->collection
    ->add("foo");
  $this->collection
    ->add(3);
  $res = $this->collection
    ->filter(function ($e) {
    return is_numeric($e);
  });
  $this
    ->assertEquals(array(
    0 => 1,
    2 => 3,
  ), $res
    ->toArray());
}