/** * @group disconnected */ public function testWritesCommandToCorrectConnection() { $profile = ServerProfile::getDefault(); $cmdExists = $profile->createCommand('exists', array('foo')); $cmdSet = $profile->getDefault()->createCommand('set', array('foo', 'bar')); $master = $this->getMockConnection('tcp://host1?alias=master'); $master->expects($this->once())->method('writeCommand')->with($cmdSet); $slave1 = $this->getMockConnection('tcp://host2?alias=slave1'); $slave1->expects($this->once())->method('writeCommand')->with($cmdExists); $replication = new MasterSlaveReplication(); $replication->add($master); $replication->add($slave1); $replication->writeCommand($cmdExists); $replication->writeCommand($cmdSet); }