From 3b505a9c604b285e207c2fddf3119881cbcb6574 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 18 Sep 2014 10:42:34 +0200 Subject: [PATCH] Fixed transaction manager tests using real DB --- src/Dao/TransactionManager.php | 2 +- tests/Dao/TransactionManagerTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dao/TransactionManager.php b/src/Dao/TransactionManager.php index e42f7481..63efee69 100644 --- a/src/Dao/TransactionManager.php +++ b/src/Dao/TransactionManager.php @@ -26,9 +26,9 @@ class TransactionManager if ($pdo->inTransaction()) return $callback(); + $pdo->beginTransaction(); try { - $pdo->beginTransaction(); $ret = $callback(); $pdo->$operation(); return $ret; diff --git a/tests/Dao/TransactionManagerTest.php b/tests/Dao/TransactionManagerTest.php index 2769b911..6059f1bd 100644 --- a/tests/Dao/TransactionManagerTest.php +++ b/tests/Dao/TransactionManagerTest.php @@ -67,11 +67,11 @@ class TransactionManagerTest extends \Szurubooru\Tests\AbstractDatabaseTestCase private function getTestDao() { - return \Szurubooru\Injector::get(\Szurubooru\Dao\TokenDao::class); + return new \Szurubooru\Dao\TokenDao($this->databaseConnection); } private function getTransactionManager() { - return \Szurubooru\Injector::get(\Szurubooru\Dao\TransactionManager::class); + return new \Szurubooru\Dao\TransactionManager($this->databaseConnection); } }