diff --git a/tests/Orm/Component/TestTest.php b/tests/Orm/Component/TestTest.php index 19e666e41..18c236d36 100644 --- a/tests/Orm/Component/TestTest.php +++ b/tests/Orm/Component/TestTest.php @@ -5,6 +5,7 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase { protected function setUp() { + parent::setUp(); $this->loadFixture('forum', 'common', 'users'); } diff --git a/tests/lib/Doctrine_DbalTestSuite.php b/tests/lib/Doctrine_DbalTestSuite.php index 6eb92ce6f..a9996c237 100644 --- a/tests/lib/Doctrine_DbalTestSuite.php +++ b/tests/lib/Doctrine_DbalTestSuite.php @@ -11,6 +11,7 @@ class Doctrine_DbalTestSuite extends Doctrine_TestSuite protected function setUp() { + // @todo Make DBMS choice configurable $pdo = new PDO('sqlite::memory:'); $this->sharedFixture['connection'] = $this->loadConnection($pdo, 'sqlite_memory'); } diff --git a/tests/lib/Doctrine_OrmTestCase.php b/tests/lib/Doctrine_OrmTestCase.php index 1c19eabb1..f854043fd 100644 --- a/tests/lib/Doctrine_OrmTestCase.php +++ b/tests/lib/Doctrine_OrmTestCase.php @@ -22,6 +22,20 @@ class Doctrine_OrmTestCase extends Doctrine_TestCase */ private static $_exportedTables = array(); + /** + * setUp() + */ + protected function setUp() + { + // Setup a db connection if there is none, yet. This makes it possible + // to run tests that use a connection standalone. + // @todo Make DBMS choice configurable + if ( ! isset($this->sharedFixture['connection'])) { + $pdo = new PDO('sqlite::memory:'); + $this->sharedFixture['connection'] = Doctrine_Manager::connection($pdo, 'sqlite_memory'); + } + } + /** * Loads a data fixture into the database. This method must only be called * from within the setUp() method of testcases. The database will then be diff --git a/tests/lib/Doctrine_OrmTestSuite.php b/tests/lib/Doctrine_OrmTestSuite.php index 4c047d6cd..d3cb7968f 100644 --- a/tests/lib/Doctrine_OrmTestSuite.php +++ b/tests/lib/Doctrine_OrmTestSuite.php @@ -10,6 +10,7 @@ class Doctrine_OrmTestSuite extends Doctrine_TestSuite { protected function setUp() { + // @todo Make DBMS choice configurable $pdo = new PDO('sqlite::memory:'); $this->sharedFixture['connection'] = $this->loadConnection($pdo, 'sqlite_memory'); }