Skip to content

Commit

Permalink
[TASK] Make SchemaColumnDefinitionListenerTest notice free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Łukasz Uznański authored and lolli42 committed Mar 17, 2018
1 parent cd3bb9d commit a21470b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ public function onSchemaColumnDefinition(SchemaColumnDefinitionEventArgs $event)
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
declare(strict_types = 1);

namespace TYPO3\CMS\Core\Tests\Unit\Database;

/*
Expand All @@ -26,17 +25,13 @@
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
*/
Expand All @@ -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);
Expand All @@ -60,7 +55,7 @@ protected function setUp()
/**
* @test
*/
public function isInactiveForStandardColumnTypes()
public function isInactiveForStandardColumnTypes(): void
{
$event = new SchemaColumnDefinitionEventArgs(
['Type' => 'int(11)'],
Expand All @@ -77,7 +72,7 @@ public function isInactiveForStandardColumnTypes()
/**
* @test
*/
public function buildsColumnForEnumDataType()
public function buildsColumnForEnumDataType(): void
{
if (Type::hasType('enum')) {
Type::overrideType('enum', EnumType::class);
Expand Down Expand Up @@ -105,7 +100,7 @@ public function buildsColumnForEnumDataType()
/**
* @test
*/
public function buildsColumnForSetDataType()
public function buildsColumnForSetDataType(): void
{
if (Type::hasType('set')) {
Type::overrideType('set', SetType::class);
Expand Down

0 comments on commit a21470b

Please sign in to comment.