You are here

public function CollectionTest::testFilter in Plug 7

File

lib/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());
}