1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Fix Testsuite to run with PHPUnit 3.5

This commit is contained in:
Benjamin Eberlei 2010-10-29 16:46:21 +02:00
parent 6006979fc6
commit 0a8ff7a030
3 changed files with 10 additions and 26 deletions

View File

@ -103,7 +103,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
*/
protected function tearDown()
{
$conn = $this->sharedFixture['conn'];
$conn = static::$_sharedConn;
$this->_sqlLoggerStack->enabled = false;
@ -185,23 +185,19 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
{
$forceCreateTables = false;
if ( ! isset($this->sharedFixture['conn'])) {
if ( ! isset(static::$_sharedConn)) {
static::$_sharedConn = TestUtil::getConnection();
}
if ( ! isset(static::$_sharedConn)) {
static::$_sharedConn = TestUtil::getConnection();
$this->sharedFixture['conn'] = static::$_sharedConn;
if ($this->sharedFixture['conn']->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
if (static::$_sharedConn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
$forceCreateTables = true;
}
}
if (isset($GLOBALS['DOCTRINE_MARK_SQL_LOGS'])) {
if (in_array($this->sharedFixture['conn']->getDatabasePlatform()->getName(), array("mysql", "postgresql"))) {
$this->sharedFixture['conn']->executeQuery('SELECT 1 /*' . get_class($this) . '*/');
} else if ($this->sharedFixture['conn']->getDatabasePlatform()->getName() == "oracle") {
$this->sharedFixture['conn']->executeQuery('SELECT 1 /*' . get_class($this) . '*/ FROM dual');
if (in_array(static::$_sharedConn->getDatabasePlatform()->getName(), array("mysql", "postgresql"))) {
static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/');
} else if (static::$_sharedConn->getDatabasePlatform()->getName() == "oracle") {
static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/ FROM dual');
}
}
@ -261,7 +257,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
$conn = $this->sharedFixture['conn'];
$conn = static::$_sharedConn;
$conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
return \Doctrine\ORM\EntityManager::create($conn, $config);

View File

@ -11,15 +11,5 @@ namespace Doctrine\Tests;
*/
class OrmFunctionalTestSuite extends OrmTestSuite
{
protected function setUp()
{
if ( ! isset($this->sharedFixture['conn'])) {
$this->sharedFixture['conn'] = TestUtil::getConnection();
}
}
protected function tearDown()
{
$this->sharedFixture = null;
}
}

View File

@ -6,8 +6,6 @@ namespace Doctrine\Tests;
error_reporting(E_ALL | E_STRICT);
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once __DIR__ . '/../../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
if (isset($GLOBALS['DOCTRINE_COMMON_PATH'])) {