Doctrine\MongoDB\Tests\CollectionEventsChangingContextTest::testAggregate PHP Method

testAggregate() public method

public testAggregate ( )
    public function testAggregate()
    {
        $pipeline = [['$match' => ['_id' => '1']]];
        $modifiedPipeline = [['$match' => ['_id' => '2']]];
        $modifiedOptions = ['foo'];
        // This listener will modify the pipeline and the options.
        $preAggregateListener = new PreAggregateListener($modifiedPipeline, $modifiedOptions);
        $eventManager = new EventManager();
        $eventManager->addEventListener([Events::preAggregate], $preAggregateListener);
        // Ensure that the modified pipeline and options are sent to the doAggregate call.
        $collection = $this->getMockCollection($eventManager, ['doAggregate' => [$modifiedPipeline, $modifiedOptions]]);
        $collection->aggregate($pipeline);
    }