Sokil\Mongo\AggregatePipelinesTest::testAggregate_Logger PHP Method

testAggregate_Logger() public method

    public function testAggregate_Logger()
    {
        // create documents
        $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();
        // create logger
        $logger = $this->getMock('\\Psr\\Log\\LoggerInterface');
        $logger->expects($this->once())->method('debug')->with('Sokil\\Mongo\\Collection:<br><b>Pipeline</b>:<br>[{"$match":{"param":{"$gte":2}}},{"$group":{"_id":0,"sum":{"$sum":"$param"}}}]');
        // set logger to client
        $this->collection->getDatabase()->getClient()->setLogger($logger);
        // aggregate
        $this->collection->createAggregator()->match(array('param' => array('$gte' => 2)))->group(array('_id' => 0, 'sum' => array('$sum' => '$param')))->aggregate();
    }