Alcaeus\MongoDbAdapter\Tests\Mongo\MongoCollectionTest::testAggregateWithMultiplePilelineOperatorsAsArguments PHP Method

testAggregateWithMultiplePilelineOperatorsAsArguments() public method

    public function testAggregateWithMultiplePilelineOperatorsAsArguments()
    {
        $collection = $this->getCollection();
        $this->prepareData();
        try {
            $result = $collection->aggregate(['$group' => ['_id' => '$foo', 'count' => ['$sum' => 1]]], ['$sort' => ['_id' => 1]]);
        } catch (\MongoResultException $ex) {
            $msg = 'MongoCollection::aggregate ( array $op [, array $op [, array $... ]] ) should accept variable amount of pipeline operators as argument' . "\n" . $ex;
            $this->fail($msg);
        }
        $this->assertInternalType('array', $result);
        $this->assertArrayHasKey('result', $result);
        $this->assertEquals([['_id' => 'bar', 'count' => 2], ['_id' => 'foo', 'count' => 1]], $result['result']);
    }
MongoCollectionTest