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

testGroup() public method

public testGroup ( )
    public function testGroup()
    {
        $keys = ['a'];
        $initial = ['b'];
        $reduce = ['c'];
        $options = ['d'];
        $modifiedKeys = ['e'];
        $modifiedInitial = ['f'];
        $modifiedReduce = ['g'];
        $modifiedOptions = ['h'];
        // This listener will modify the pipeline and the options.
        $preGroupListener = new PreGroupListener($modifiedKeys, $modifiedInitial, $modifiedReduce, $modifiedOptions);
        $eventManager = new EventManager();
        $eventManager->addEventListener([Events::preGroup], $preGroupListener);
        // Ensure that the modified pipeline and options are sent to the doAggregate call.
        $collection = $this->getMockCollection($eventManager, ['doGroup' => [$modifiedKeys, $modifiedInitial, $modifiedReduce, $modifiedOptions]]);
        $collection->group($keys, $initial, $reduce, $options);
    }