/**
  * @group disconnected
  */
 public function testAcceptsCallableToOverrideReadOnlyFlagForCommands()
 {
     $profile = ServerProfile::getDefault();
     $cmdExistsFoo = $profile->createCommand('exists', array('foo'));
     $cmdExistsBar = $profile->createCommand('exists', array('bar'));
     $master = $this->getMockConnection('tcp://host1?alias=master');
     $master->expects($this->once())->method('executeCommand')->with($cmdExistsBar);
     $slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
     $slave1->expects($this->once())->method('executeCommand')->with($cmdExistsFoo);
     $replication = new MasterSlaveReplication();
     $replication->add($master);
     $replication->add($slave1);
     $replication->setCommandReadOnly('exists', function ($cmd) {
         list($arg1) = $cmd->getArguments();
         return $arg1 === 'foo';
     });
     $replication->executeCommand($cmdExistsFoo);
     $replication->executeCommand($cmdExistsBar);
 }