[TASK] Make SchemaColumnDefinitionListenerTest notice free 14/56314/3
authorŁukasz Uznański <l.uznanski@macopedia.pl>
Sat, 17 Mar 2018 14:48:10 +0000 (15:48 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 17 Mar 2018 17:08:57 +0000 (18:08 +0100)
Resolves: #84440
Releases: master
Change-Id: Ibb1f891afffa3dd5bd7d06a32180ac1a47ce778e
Reviewed-on: https://review.typo3.org/56314
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Database/Schema/EventListener/SchemaColumnDefinitionListener.php
typo3/sysext/core/Tests/Unit/Database/Schema/EventListener/SchemaColumnDefinitionListenerTest.php

index d345d9a..168a630 100644 (file)
@@ -65,21 +65,21 @@ class SchemaColumnDefinitionListener
     protected function getEnumerationTableColumnDefinition(array $tableColumn, AbstractPlatform $platform): Column
     {
         $options = [
-            'length' => $tableColumn['length'] ?: null,
+            'length' => $tableColumn['length'] ?? null,
             'unsigned' => false,
             'fixed' => false,
-            'default' => $tableColumn['default'] ?: null,
-            'notnull' => (bool)($tableColumn['null'] !== 'YES'),
+            'default' => $tableColumn['default'] ?? null,
+            'notnull' => ($tableColumn['null'] ?? '') !== 'YES',
             'scale' => null,
             'precision' => null,
             'autoincrement' => false,
-            'comment' => $tableColumn['comment'] ?: null,
+            'comment' => $tableColumn['comment'] ?? null,
         ];
 
         $dbType = $this->getDatabaseType($tableColumn['type']);
         $doctrineType = $platform->getDoctrineTypeMapping($dbType);
 
-        $column = new Column($tableColumn['field'], Type::getType($doctrineType), $options);
+        $column = new Column($tableColumn['field'] ?? null, Type::getType($doctrineType), $options);
         $column->setPlatformOption('unquotedValues', $this->getUnquotedEnumerationValues($tableColumn['type']));
 
         return $column;
index 1fdac50..e15e4c1 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 declare(strict_types = 1);
-
 namespace TYPO3\CMS\Core\Tests\Unit\Database;
 
 /*
@@ -26,18 +25,14 @@ use TYPO3\CMS\Core\Database\Schema\EventListener\SchemaColumnDefinitionListener;
 use TYPO3\CMS\Core\Database\Schema\Types\EnumType;
 use TYPO3\CMS\Core\Database\Schema\Types\SetType;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class SchemaColumnDefinitionListenerTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var SchemaColumnDefinitionListener
      */
     protected $subject;
@@ -50,7 +45,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un
     /**
      * Set up the test subject
      */
-    protected function setUp()
+    protected function setUp(): void
     {
         parent::setUp();
         $this->subject = GeneralUtility::makeInstance(SchemaColumnDefinitionListener::class);
@@ -60,7 +55,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un
     /**
      * @test
      */
-    public function isInactiveForStandardColumnTypes()
+    public function isInactiveForStandardColumnTypes(): void
     {
         $event = new SchemaColumnDefinitionEventArgs(
             ['Type' => 'int(11)'],
@@ -77,7 +72,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un
     /**
      * @test
      */
-    public function buildsColumnForEnumDataType()
+    public function buildsColumnForEnumDataType(): void
     {
         if (Type::hasType('enum')) {
             Type::overrideType('enum', EnumType::class);
@@ -105,7 +100,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un
     /**
      * @test
      */
-    public function buildsColumnForSetDataType()
+    public function buildsColumnForSetDataType(): void
     {
         if (Type::hasType('set')) {
             Type::overrideType('set', SetType::class);