lithium\tests\cases\util\CollectionTest::testCollectionEachFilter PHP Method

testCollectionEachFilter() public method

Tests that the each() filter applies the callback to each item in the current collection, returning an instance of itself.
    public function testCollectionEachFilter()
    {
        $collection = new Collection(array('data' => array(1, 2, 3, 4, 5)));
        $filter = function ($item) {
            return ++$item;
        };
        $result = $collection->each($filter);
        $this->assertIdentical($collection, $result);
        $this->assertEqual(array(2, 3, 4, 5, 6), $collection->to('array'));
    }