From 9aa6349c394edfa6ea25f289d3303fcfa18b6f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20L=C3=B6ffler?= Date: Fri, 16 Mar 2018 22:16:41 +0100 Subject: [PATCH] [TASK] Make PdoBackendTest notice free Resolves: #84378 Releases: master Change-Id: Ia17ae3e651da32507d43c313cab73e7bd34632e9 Reviewed-on: https://review.typo3.org/56258 Tested-by: TYPO3com Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring Reviewed-by: Tymoteusz Motylewski Tested-by: Tymoteusz Motylewski --- .../core/Classes/Log/Writer/FileWriter.php | 2 +- .../Unit/Cache/Backend/PdoBackendTest.php | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/typo3/sysext/core/Classes/Log/Writer/FileWriter.php b/typo3/sysext/core/Classes/Log/Writer/FileWriter.php index 25a4f2709057..d7022fe4326e 100644 --- a/typo3/sysext/core/Classes/Log/Writer/FileWriter.php +++ b/typo3/sysext/core/Classes/Log/Writer/FileWriter.php @@ -152,7 +152,7 @@ public function writeLog(LogRecord $record) */ protected function openLogFile() { - if (is_resource(self::$logFileHandles[$this->logFile])) { + if (isset(self::$logFileHandles[$this->logFile]) && is_resource(self::$logFileHandles[$this->logFile])) { return; } diff --git a/typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php b/typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php index 856e0b2f3279..c9b6505fda63 100644 --- a/typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php +++ b/typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php @@ -1,4 +1,5 @@ expectException(\TYPO3\CMS\Core\Cache\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionCode(1259515600); - $backend = new \TYPO3\CMS\Core\Cache\Backend\PdoBackend('Testing'); + $backend = new PdoBackend('Testing'); $data = 'Some data'; $identifier = 'MyIdentifier'; $backend->set($identifier, $data); @@ -218,11 +220,11 @@ public function flushRemovesAllCacheEntries() */ public function flushRemovesOnlyOwnEntries() { - $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class); + $thisCache = $this->createMock(FrontendInterface::class); $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache')); $thisBackend = $this->setUpBackend(); $thisBackend->setCache($thisCache); - $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class); + $thatCache = $this->createMock(FrontendInterface::class); $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache')); $thatBackend = $this->setUpBackend(); $thatBackend->setCache($thatCache); @@ -279,9 +281,9 @@ public function collectGarbageReallyRemovesAllExpiredCacheEntries() */ protected function setUpBackend() { - $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class); + $mockCache = $this->createMock(FrontendInterface::class); $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache')); - $backend = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\Backend\PdoBackend::class, 'Testing'); + $backend = GeneralUtility::makeInstance(PdoBackend::class, 'Testing'); $backend->setCache($mockCache); $backend->setDataSourceName('sqlite::memory:'); $backend->initializeObject();