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

testMapReduce() public method

public testMapReduce ( )
    public function testMapReduce()
    {
        $map = ['a'];
        $reduce = ['b'];
        $out = ['c'];
        $query = ['d'];
        $options = ['e'];
        $modifiedMap = ['f'];
        $modifiedReduce = ['g'];
        $modifiedOut = ['h'];
        $modifiedQuery = ['i'];
        $modifiedOptions = ['j'];
        // This listener will modify the data and options.
        $mapReduceListener = new PreMapReduceListener($modifiedMap, $modifiedReduce, $modifiedOut, $modifiedQuery, $modifiedOptions);
        $eventManager = new EventManager();
        $eventManager->addEventListener([Events::preMapReduce], $mapReduceListener);
        // Ensure that the modified pipeline and options are sent to the doAggregate call.
        $collection = $this->getMockCollection($eventManager, ['doMapReduce' => [$modifiedMap, $modifiedReduce, $modifiedOut, $modifiedQuery, $modifiedOptions]]);
        $collection->mapReduce($map, $reduce, $out, $query, $options);
    }