Commit 61f09cef authored by Steve Müller's avatar Steve Müller

Merge pull request #784 from weaverryan/prove-connection-closed-test-flawed

"Breaking" a test temporarily to show that it's not doing what is expect...
parents 44ab7bcd 9d8be7b1
......@@ -399,13 +399,27 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$this->assertSame($result, $conn->fetchColumn($statement, $params, $column, $types));
}
public function testConnectionIsClosed()
public function testConnectionIsClosedButNotUnset()
{
$this->_conn->close();
// mock Connection, and make connect() purposefully do nothing
$connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
->disableOriginalConstructor()
->setMethods(array('connect'))
->getMock();
// artificially set the wrapped connection to non-null
$reflection = new \ReflectionObject($connection);
$connProperty = $reflection->getProperty('_conn');
$connProperty->setAccessible(true);
$connProperty->setValue($connection, new \stdClass);
$this->setExpectedException('Doctrine\\DBAL\\Exception\\DriverException');
// close the connection (should nullify the wrapped connection)
$connection->close();
$this->_conn->quoteIdentifier('Bug');
// the wrapped connection should be null
// (and since connect() does nothing, this will not reconnect)
// this will also fail if this _conn property was unset instead of set to null
$this->assertNull($connection->getWrappedConnection());
}
public function testFetchAll()
......
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