/**
  * @group disconnected
  */
 public function testCanBeSerialized()
 {
     $master = $this->getMockConnection('tcp://host1?alias=master');
     $slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
     $replication = new MasterSlaveReplication();
     $replication->add($master);
     $replication->add($slave1);
     $unserialized = unserialize(serialize($replication));
     $this->assertEquals($master, $unserialized->getConnectionById('master'));
     $this->assertEquals($slave1, $unserialized->getConnectionById('slave1'));
 }
 /**
  * @group disconnected
  */
 public function testCanSetReadOnlyFlagForEvalScripts()
 {
     $profile = ServerProfile::get('dev');
     $cmdEval = $profile->createCommand('eval', array($script = "return redis.call('info');"));
     $cmdEvalSha = $profile->createCommand('evalsha', array($scriptSHA1 = sha1($script)));
     $master = $this->getMockConnection('tcp://host1?alias=master');
     $master->expects($this->never())->method('executeCommand');
     $slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
     $slave1->expects($this->exactly(2))->method('executeCommand')->with($this->logicalOr($cmdEval, $cmdEvalSha));
     $replication = new MasterSlaveReplication();
     $replication->add($master);
     $replication->add($slave1);
     $replication->setScriptReadOnly($script);
     $replication->executeCommand($cmdEval);
     $replication->executeCommand($cmdEvalSha);
 }