Commit cc8e0222 authored by Marco Pivetta's avatar Marco Pivetta

Merge pull request #726 from alekitto/ms_reconnect_notice

MasterSlaveConnection::close() should reset connections array
parents a2e87c57 fcbb2a7f
......@@ -290,6 +290,9 @@ class MasterSlaveConnection extends Connection
unset($this->connections['slave']);
parent::close();
$this->_conn = null;
$this->connections = array('master' => null, 'slave' => null);
}
/**
......
......@@ -126,4 +126,17 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$conn->connect('slave');
$this->assertFalse($conn->isConnectedToMaster());
}
public function testMasterSlaveConnectionCloseAndReconnect()
{
$conn = $this->createMasterSlaveConnection();
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
$conn->close();
$this->assertFalse($conn->isConnectedToMaster());
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment