phpstreams\tests\unit\StreamTest::testReduce PHP Method

testReduce() public method

public testReduce ( )
    public function testReduce()
    {
        $instance = new Stream([1, 2, 3, 4]);
        $result = $instance->reduce(0, function ($a, $b) {
            return $a + $b;
        });
        $this->assertEquals(10, $result);
    }