diff --git a/tests/Doctrine/Tests/DbalFunctionalTestCase.php b/tests/Doctrine/Tests/DbalFunctionalTestCase.php index 351345551..1cc3aa2f4 100644 --- a/tests/Doctrine/Tests/DbalFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DbalFunctionalTestCase.php @@ -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; } } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index ce0e0ecd9..97fc6f753 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -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; }