public function CollectionTest::testMap

File

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

Class

CollectionTest

Namespace

Doctrine\Tests\Common\Collections

Code

public function testMap() {
  $this->_coll
    ->add(1);
  $this->_coll
    ->add(2);
  $res = $this->_coll
    ->map(function ($e) {
    return $e * 2;
  });
  $this
    ->assertEquals(array(
    2,
    4,
  ), $res
    ->toArray());
}