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

testFindAndUpdate() public method

public testFindAndUpdate ( )
    public function testFindAndUpdate()
    {
        $query = ['a'];
        $newObj = ['b'];
        $options = ['c'];
        $modifiedQuery = ['d'];
        $modifiedNewObj = ['e'];
        $modifiedOptions = ['f'];
        // This listener will modify the data and options.
        $preFindAndUpdateEventListener = new PreFindAndUpdateListener($modifiedQuery, $modifiedNewObj, $modifiedOptions);
        $eventManager = new EventManager();
        $eventManager->addEventListener([Events::preFindAndUpdate], $preFindAndUpdateEventListener);
        // Ensure that the modified pipeline and options are sent to the doAggregate call.
        $collection = $this->getMockCollection($eventManager, ['doFindAndUpdate' => [$modifiedQuery, $modifiedNewObj, $modifiedOptions]]);
        $collection->findAndUpdate($query, $newObj, $options);
    }