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

testCount() public method

public testCount ( )
    public function testCount()
    {
        $stream = new Stream([1, 2, 3, 4, 5, 6]);
        $this->assertEquals(6, $stream->count());
        $this->assertEquals(6, count($stream));
        $filteredStream = $stream->filter(function ($value) {
            return $value % 2 == 1;
        });
        $this->assertEquals(3, $filteredStream->count());
    }