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

testFindOne() public method

public testFindOne ( )
    public function testFindOne()
    {
        $query = ['a'];
        $fields = ['b'];
        $modifiedQuery = ['c'];
        $modifiedFields = ['d'];
        // This listener will modify the pipeline and the options.
        $preFindOneListener = new PreFindOneListener($modifiedQuery, $modifiedFields);
        $eventManager = new EventManager();
        $eventManager->addEventListener([Events::preFindOne], $preFindOneListener);
        // Ensure that the modified pipeline and options are sent to the doAggregate call.
        $collection = $this->getMockCollection($eventManager, ['doFindOne' => [$modifiedQuery, $modifiedFields]]);
        $collection->findOne($query, $fields);
    }