Alcaeus\MongoDbAdapter\Tests\Mongo\MongoCollectionTest::testReadPreferenceIsSetInDriver PHP Method

testReadPreferenceIsSetInDriver() public method

    public function testReadPreferenceIsSetInDriver()
    {
        $this->skipTestIf(extension_loaded('mongo'));
        $collection = $this->getCollection();
        $this->assertTrue($collection->setReadPreference(\MongoClient::RP_SECONDARY, [['a' => 'b']]));
        // Only way to check whether options are passed down is through debugInfo
        $readPreference = $collection->getCollection()->__debugInfo()['readPreference'];
        $this->assertSame(ReadPreference::RP_SECONDARY, $readPreference->getMode());
        $this->assertSame([['a' => 'b']], $readPreference->getTagSets());
    }
MongoCollectionTest