phpstream\tests\unit\operations\MappingOperationTest::testMapping PHP Method

testMapping() public method

public testMapping ( )
    public function testMapping()
    {
        $mapping = new MappingOperation([1, 2, 3, 4, 5], function ($value) {
            return $value * 2;
        });
        $result = iterator_to_array($mapping);
        $this->assertEquals([2, 4, 6, 8, 10], $result);
    }
MappingOperationTest