From d8430f549d3a224695229485818a89455d56f366 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Tue, 19 Jun 2018 18:31:59 +0100 Subject: [PATCH] Address feedback --- src/Dev/State/FixtureTestState.php | 7 ++++--- src/ORM/Connect/Database.php | 2 +- src/ORM/Connect/MySQLDatabase.php | 5 +---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Dev/State/FixtureTestState.php b/src/Dev/State/FixtureTestState.php index ec5a32d32..80ac22e4f 100644 --- a/src/Dev/State/FixtureTestState.php +++ b/src/Dev/State/FixtureTestState.php @@ -166,7 +166,7 @@ class FixtureTestState implements TestState $this->loadFixture($fixtureFile, $test); } // Flag as loaded - $this->loaded[get_class($test)] = true; + $this->loaded[strtolower(get_class($test))] = true; } /** @@ -265,7 +265,8 @@ class FixtureTestState implements TestState */ protected function resetFixtureFactory($class) { - $this->fixtureFactories[strtolower($class)] = Injector::inst()->create(FixtureFactory::class); + $class = strtolower($class); + $this->fixtureFactories[$class] = Injector::inst()->create(FixtureFactory::class); $this->loaded[$class] = false; } @@ -277,6 +278,6 @@ class FixtureTestState implements TestState */ protected function getIsLoaded($class) { - return !empty($this->loaded[$class]); + return !empty($this->loaded[strtolower($class)]); } } diff --git a/src/ORM/Connect/Database.php b/src/ORM/Connect/Database.php index 4c60ed085..670b07b5b 100644 --- a/src/ORM/Connect/Database.php +++ b/src/ORM/Connect/Database.php @@ -676,7 +676,7 @@ abstract class Database public function transactionDepth() { // Placeholder error for transactional DBs that don't expose depth - if ($this->supportsTransactions()) { + if (!$this->supportsTransactions()) { user_error(get_class($this) . " does not support transactionDepth", E_USER_WARNING); } return 0; diff --git a/src/ORM/Connect/MySQLDatabase.php b/src/ORM/Connect/MySQLDatabase.php index 49f6dd62d..0477591de 100644 --- a/src/ORM/Connect/MySQLDatabase.php +++ b/src/ORM/Connect/MySQLDatabase.php @@ -360,10 +360,7 @@ class MySQLDatabase extends Database return false; } --$this->transactionNesting; - if ($this->transactionNesting <= 0) { - $this->transactionNesting = 0; - $this->query('COMMIT AND ' . ($chain ? '' : 'NO ') . 'CHAIN'); - } + $this->query('COMMIT AND ' . ($chain ? '' : 'NO ') . 'CHAIN'); return true; }