From 52431251cbe1aff0d7fef1ec7135540d0d345f04 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 26 Jun 2011 17:20:03 +0200 Subject: [PATCH] Fix some of the problems with Oracle testsuite --- lib/vendor/doctrine-dbal | 2 +- .../Tests/ORM/Functional/QueryDqlFunctionTest.php | 13 +++++++++---- tests/Doctrine/Tests/OrmFunctionalTestCase.php | 7 +++++++ tests/Doctrine/Tests/TestUtil.php | 12 +----------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/vendor/doctrine-dbal b/lib/vendor/doctrine-dbal index f2c150d19..4cfb32db0 160000 --- a/lib/vendor/doctrine-dbal +++ b/lib/vendor/doctrine-dbal @@ -1 +1 @@ -Subproject commit f2c150d194af4ac846362ef8c6bf002402ed5f63 +Subproject commit 4cfb32db00da53638bc2dca84e3e63553fdf3c5b diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php index 42971e6b0..e37ea9f62 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php @@ -274,10 +274,15 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase */ public function testDateDiff() { - $arg = $this->_em->createQuery("SELECT DATE_DIFF(CURRENT_TIMESTAMP(), '2011-01-01') AS diff FROM Doctrine\Tests\Models\Company\CompanyManager m") - ->getARrayResult(); - - $this->assertTrue($arg[0]['diff'] > 0); + $query = $this->_em->createQuery("SELECT DATE_DIFF(CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(), 10, 'day')) AS diff FROM Doctrine\Tests\Models\Company\CompanyManager m"); + $arg = $query->getArrayResult(); + + $this->assertEquals(-10, $arg[0]['diff'], "Should be roughly -10 (or -9)", 1); + + $query = $this->_em->createQuery("SELECT DATE_DIFF(DATE_ADD(CURRENT_TIMESTAMP(), 10, 'day'), CURRENT_TIMESTAMP()) AS diff FROM Doctrine\Tests\Models\Company\CompanyManager m"); + $arg = $query->getArrayResult(); + + $this->assertEquals(10, $arg[0]['diff'], "Should be roughly 10 (or 9)", 1); } /** diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 516a72aa2..92320e3a4 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -297,6 +297,13 @@ abstract class OrmFunctionalTestCase extends OrmTestCase } } + if (isset($GLOBALS['db_event_subscribers'])) { + foreach (explode(",", $GLOBALS['db_event_subscribers']) AS $subscriberClass) { + $subscriberInstance = new $subscriberClass(); + $evm->addEventSubscriber($subscriberInstance); + } + } + return \Doctrine\ORM\EntityManager::create($conn, $config); } diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php index 5a187e595..a77812f7f 100644 --- a/tests/Doctrine/Tests/TestUtil.php +++ b/tests/Doctrine/Tests/TestUtil.php @@ -77,17 +77,7 @@ class TestUtil } } - $eventManager = null; - if (isset($GLOBALS['db_event_subscribers'])) { - $eventManager = new \Doctrine\Common\EventManager(); - foreach (explode(",", $GLOBALS['db_event_subscribers']) AS $subscriberClass) { - $subscriberInstance = new $subscriberClass(); - $eventManager->addEventSubscriber($subscriberInstance); - } - } - - $conn = \Doctrine\DBAL\DriverManager::getConnection($realDbParams, null, $eventManager); - + $conn = \Doctrine\DBAL\DriverManager::getConnection($realDbParams, null, null); } else { $params = array( 'driver' => 'pdo_sqlite',