Skip to content

Commit

Permalink
Fix some of the problems with Oracle testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Jun 26, 2011
1 parent 6994401 commit 5243125
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
13 changes: 9 additions & 4 deletions tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php
Expand Up @@ -274,10 +274,15 @@ public function testConcatFunction()
*/
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);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/Doctrine/Tests/OrmFunctionalTestCase.php
Expand Up @@ -297,6 +297,13 @@ protected function _getEntityManager($config = null, $eventManager = null) {
}
}

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);
}

Expand Down
12 changes: 1 addition & 11 deletions tests/Doctrine/Tests/TestUtil.php
Expand Up @@ -77,17 +77,7 @@ public static function getConnection()
}
}

$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',
Expand Down

0 comments on commit 5243125

Please sign in to comment.