[2.0] Fixed connection sharing when Functional DBAL or ORM tests are run standalone.
This commit is contained in:
parent
acec85a412
commit
2a9886af48
@ -4,15 +4,19 @@ namespace Doctrine\Tests;
|
||||
|
||||
class DbalFunctionalTestCase extends DbalTestCase
|
||||
{
|
||||
/* Shared connection when a TestCase is run alone (outside of it's functional suite) */
|
||||
private static $_sharedConn;
|
||||
protected $_conn;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if ( ! isset($this->_conn)) {
|
||||
if ( ! isset($this->sharedFixture['conn'])) {
|
||||
$this->sharedFixture['conn'] = TestUtil::getConnection();
|
||||
}
|
||||
if (isset($this->sharedFixture['conn'])) {
|
||||
$this->_conn = $this->sharedFixture['conn'];
|
||||
} else {
|
||||
if ( ! isset(self::$_sharedConn)) {
|
||||
self::$_sharedConn = TestUtil::getConnection();
|
||||
}
|
||||
$this->_conn = self::$_sharedConn;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,9 @@ class OrmFunctionalTestCase extends OrmTestCase
|
||||
/* The query cache shared between all functional tests. */
|
||||
private static $_queryCacheImpl = null;
|
||||
|
||||
/* Shared connection when a TestCase is run alone (outside of it's functional suite) */
|
||||
private static $_sharedConn;
|
||||
|
||||
/** The EntityManager for this testcase. */
|
||||
protected $_em;
|
||||
|
||||
@ -79,8 +82,12 @@ class OrmFunctionalTestCase extends OrmTestCase
|
||||
protected function setUp()
|
||||
{
|
||||
$forceCreateTables = false;
|
||||
|
||||
if ( ! isset($this->sharedFixture['conn'])) {
|
||||
$this->sharedFixture['conn'] = TestUtil::getConnection();
|
||||
if ( ! isset(self::$_sharedConn)) {
|
||||
self::$_sharedConn = TestUtil::getConnection();
|
||||
}
|
||||
$this->sharedFixture['conn'] = self::$_sharedConn;
|
||||
if ($this->sharedFixture['conn']->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
|
||||
$forceCreateTables = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user