/** * @group disconnected */ public function testCanSwitchConnectionByAlias() { $master = $this->getMockConnection('tcp://host1?alias=master'); $slave1 = $this->getMockConnection('tcp://host2?alias=slave1'); $replication = new MasterSlaveReplication(); $replication->add($master); $replication->add($slave1); $this->assertNull($replication->getCurrent()); $replication->switchTo('master'); $this->assertSame($master, $replication->getCurrent()); $replication->switchTo('slave1'); $this->assertSame($slave1, $replication->getCurrent()); }