Sokil\Mongo\AggregatePipelinesTest::testAggregate_FluentInterface PHP Method

testAggregate_FluentInterface() public method

    public function testAggregate_FluentInterface()
    {
        $this->collection->createDocument(array('param' => 1))->save();
        $this->collection->createDocument(array('param' => 2))->save();
        $this->collection->createDocument(array('param' => 3))->save();
        $this->collection->createDocument(array('param' => 4))->save();
        $result = $this->collection->createAggregator()->match(array('param' => array('$gte' => 2)))->group(array('_id' => 0, 'sum' => array('$sum' => '$param')))->aggregate();
        $this->assertEquals(9, $result[0]['sum']);
    }