[TASK] Make LogRecordTest notice free 78/56178/4
authorSascha Löffler <lsascha@gmail.com>
Thu, 15 Mar 2018 16:10:44 +0000 (17:10 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 15 Mar 2018 17:45:03 +0000 (18:45 +0100)
Resolves: #84309
Releases: master
Change-Id: I494c587ae28d4370e6c6da8edd467beba8eb436a
Reviewed-on: https://review.typo3.org/56178
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php

index d6a383f..3273584 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Core\Tests\Unit\Log;
 
 /*
@@ -14,28 +15,29 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Log\LogLevel;
 use TYPO3\CMS\Core\Log\LogRecord;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class LogRecordTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class LogRecordTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * Returns a \TYPO3\CMS\Core\Log\LogRecord
+     * Returns a LogRecord
      *
-     * @param array $parameters Parameters to set in \TYPO3\CMS\Core\Log\LogRecord constructor.
+     * @param array $parameters Parameters to set in LogRecord constructor.
      * @return LogRecord
      */
-    protected function getRecord(array $parameters = [])
+    protected function getRecord(array $parameters = []): LogRecord
     {
-        /** @var $record LogRecord */
-        $record = new LogRecord($parameters['component'] ?: 'test.core.log', $parameters['level'] ?: \TYPO3\CMS\Core\Log\LogLevel::DEBUG, $parameters['message'] ?: 'test message', $parameters['data'] ?: []);
+        $record = new LogRecord(
+            $parameters['component'] ?? 'test.core.log',
+            $parameters['level'] ?? LogLevel::DEBUG,
+            $parameters['message'] ?? 'test message',
+            $parameters['data'] ?? []
+        );
         return $record;
     }
 
@@ -54,7 +56,7 @@ class LogRecordTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructorSetsCorrectLogLevel()
     {
-        $logLevel = \TYPO3\CMS\Core\Log\LogLevel::CRITICAL;
+        $logLevel = LogLevel::CRITICAL;
         $record = $this->getRecord(['level' => $logLevel]);
         $this->assertEquals($logLevel, $record->getLevel());
     }
@@ -97,7 +99,7 @@ class LogRecordTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function setLevelSetsLevel()
     {
         $record = $this->getRecord();
-        $level = \TYPO3\CMS\Core\Log\LogLevel::EMERGENCY;
+        $level = LogLevel::EMERGENCY;
         $this->assertEquals($level, $record->setLevel($level)->getLevel());
     }
 
@@ -149,7 +151,7 @@ class LogRecordTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function toArrayReturnsCorrectValues()
     {
         $component = 'test.core.log';
-        $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+        $level = LogLevel::DEBUG;
         $message = 'test message';
         $data = ['foo' => 'bar'];
         /** @var $record LogRecord */