Commit f277888f authored by Jan Helke's avatar Jan Helke Committed by Christian Kuhn
Browse files

[TASK] Make sysext/backend/Tests/Unit/ notice free

Releases: master
Resolves: #84413
Change-Id: Iff7c9c3b205df958fa57f6325645730d97fceefb
Reviewed-on: https://review.typo3.org/56286


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 0f894ddd
......@@ -175,7 +175,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
{
$ajaxArguments = $request->getParsedBody()['ajax'] ?? $request->getQueryParams()['ajax'];
$domObjectId = $ajaxArguments[0];
$domObjectId = $ajaxArguments[0] ?? null;
$inlineFirstPid = $this->getInlineFirstPidFromDomObjectId($domObjectId);
$parentConfig = $this->extractSignedParentConfigFromRequest((string)$ajaxArguments['context']);
......@@ -256,8 +256,8 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
public function synchronizeLocalizeAction(ServerRequestInterface $request): ResponseInterface
{
$ajaxArguments = $request->getParsedBody()['ajax'] ?? $request->getQueryParams()['ajax'];
$domObjectId = $ajaxArguments[0];
$type = $ajaxArguments[1];
$domObjectId = $ajaxArguments[0] ?? null;
$type = $ajaxArguments[1] ?? null;
$parentConfig = $this->extractSignedParentConfigFromRequest((string)$ajaxArguments['context']);
/** @var InlineStackProcessor $inlineStackProcessor */
......
......@@ -40,19 +40,19 @@ class SuggestWizardController
{
$parsedBody = $request->getParsedBody();
$search = $parsedBody['value'];
$tableName = $parsedBody['tableName'];
$fieldName = $parsedBody['fieldName'];
$uid = $parsedBody['uid'];
$pid = (int)$parsedBody['pid'];
$dataStructureIdentifier = '';
$search = $parsedBody['value'] ?? null;
$tableName = $parsedBody['tableName'] ?? null;
$fieldName = $parsedBody['fieldName'] ?? null;
$uid = $parsedBody['uid'] ?? null;
$pid = isset($parsedBody['pid']) ? (int)$parsedBody['pid'] : 0;
$dataStructureIdentifier = '' ?? null;
if (!empty($parsedBody['dataStructureIdentifier'])) {
$dataStructureIdentifier = json_encode($parsedBody['dataStructureIdentifier']);
}
$flexFormSheetName = $parsedBody['flexFormSheetName'];
$flexFormFieldName = $parsedBody['flexFormFieldName'];
$flexFormContainerName = $parsedBody['flexFormContainerName'];
$flexFormContainerFieldName = $parsedBody['flexFormContainerFieldName'];
$flexFormSheetName = $parsedBody['flexFormSheetName'] ?? null;
$flexFormFieldName = $parsedBody['flexFormFieldName'] ?? null;
$flexFormContainerName = $parsedBody['flexFormContainerName'] ?? null;
$flexFormContainerFieldName = $parsedBody['flexFormContainerFieldName'] ?? null;
// Determine TCA config of field
if (empty($dataStructureIdentifier)) {
......
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Tests\Unit\Controller;
/*
......@@ -17,21 +18,17 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Controller;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Controller\FormInlineAjaxController;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Test case
*/
class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
class FormInlineAjaxControllerTest extends UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;
/**
* @test
*/
public function createActionThrowsExceptionIfContextIsEmpty()
public function createActionThrowsExceptionIfContextIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -49,7 +46,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function createActionThrowsExceptionIfContextConfigSectionIsEmpty()
public function createActionThrowsExceptionIfContextConfigSectionIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -67,7 +64,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function createActionThrowsExceptionIfContextConfigSectionDoesNotValidate()
public function createActionThrowsExceptionIfContextConfigSectionDoesNotValidate(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -92,7 +89,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function detailsActionThrowsExceptionIfContextIsEmpty()
public function detailsActionThrowsExceptionIfContextIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -110,7 +107,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function detailsActionThrowsExceptionIfContextConfigSectionIsEmpty()
public function detailsActionThrowsExceptionIfContextConfigSectionIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -128,7 +125,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function detailsActionThrowsExceptionIfContextConfigSectionDoesNotValidate()
public function detailsActionThrowsExceptionIfContextConfigSectionDoesNotValidate(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -153,7 +150,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function synchronizeLocalizeActionThrowsExceptionIfContextIsEmpty()
public function synchronizeLocalizeActionThrowsExceptionIfContextIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -171,7 +168,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function synchronizeLocalizeActionThrowsExceptionIfContextConfigSectionIsEmpty()
public function synchronizeLocalizeActionThrowsExceptionIfContextConfigSectionIsEmpty(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -189,7 +186,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
/**
* @test
*/
public function synchronizeLocalizeActionThrowsExceptionIfContextConfigSectionDoesNotValidate()
public function synchronizeLocalizeActionThrowsExceptionIfContextConfigSectionDoesNotValidate(): void
{
$requestProphecy = $this->prophesize(ServerRequestInterface::class);
$requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
......@@ -217,7 +214,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
*
* @test
*/
public function getInlineExpandCollapseStateArraySwitchesToFallbackIfTheBackendUserDoesNotHaveAnUCInlineViewProperty()
public function getInlineExpandCollapseStateArraySwitchesToFallbackIfTheBackendUserDoesNotHaveAnUCInlineViewProperty(): void
{
$backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
$backendUserProphecy->uc = [];
......@@ -242,7 +239,7 @@ class FormInlineAjaxControllerTest extends \TYPO3\TestingFramework\Core\Unit\Uni
*
* @test
*/
public function getInlineExpandCollapseStateArrayWillUnserializeUCInlineViewPropertyAsAnArrayWithData()
public function getInlineExpandCollapseStateArrayWillUnserializeUCInlineViewPropertyAsAnArrayWithData(): void
{
$backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
$backendUserProphecy->uc = ['inlineView' => serialize(['foo' => 'bar'])];
......
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Tests\Unit\Controller\Wizard;
/*
......@@ -18,21 +19,17 @@ use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Test case
*/
class SuggestWizardControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
class SuggestWizardControllerTest extends UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;
/**
* @test
*/
public function getFlexFieldConfigurationThrowsExceptionIfSimpleFlexFieldIsNotFound()
public function getFlexFieldConfigurationThrowsExceptionIfSimpleFlexFieldIsNotFound(): void
{
$serverRequestProphecy = $this->prophesize(ServerRequestInterface::class);
$serverRequestProphecy->getParsedBody()->willReturn([
......@@ -77,7 +74,7 @@ class SuggestWizardControllerTest extends \TYPO3\TestingFramework\Core\Unit\Unit
/**
* @test
*/
public function getFlexFieldConfigurationThrowsExceptionIfSectionContainerFlexFieldIsNotFound()
public function getFlexFieldConfigurationThrowsExceptionIfSectionContainerFlexFieldIsNotFound(): void
{
$serverRequestProphecy = $this->prophesize(ServerRequestInterface::class);
$serverRequestProphecy->getParsedBody()->willReturn([
......@@ -122,14 +119,19 @@ class SuggestWizardControllerTest extends \TYPO3\TestingFramework\Core\Unit\Unit
/**
* @test
* @dataProvider isTableHiddenIsProperlyRetrievedDataProvider
* @param bool $expected
* @param array $array
*/
public function isTableHiddenIsProperlyRetrieved($expected, $array)
public function isTableHiddenIsProperlyRetrieved(bool $expected, array $array): void
{
$subject = $this->getAccessibleMock(SuggestWizardController::class, ['dummy'], [], '', false);
$this->assertEquals($expected, $subject->_call('isTableHidden', $array));
}
public function isTableHiddenIsProperlyRetrievedDataProvider()
/**
* @return array
*/
public function isTableHiddenIsProperlyRetrievedDataProvider(): array
{
return [
'notSetValue' => [false, ['ctrl' => ['hideTable' => null]]],
......
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Form\FormDataProvider;
/*
......@@ -27,11 +28,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;
/**
* @var TcaFlexPrepare
*/
......
......@@ -1121,7 +1121,7 @@ class TcaMigration
continue;
}
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] !== 'input') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] !== 'input') {
continue;
}
$eval = $fieldConfig['config']['eval'] ?? '';
......@@ -1300,7 +1300,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'input' || $fieldConfig['config']['type'] === 'text') {
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'input' || $fieldConfig['config']['type'] === 'text')) {
if (isset($fieldConfig['config']['wizards']) && is_array($fieldConfig['config']['wizards'])) {
foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
if (isset($wizardConfig['type'])
......@@ -1372,7 +1372,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'input') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'input') {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])) {
foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
......@@ -1437,7 +1437,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'input'
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'input'
&& !isset($fieldConfig['config']['renderType'])
) {
if (isset($fieldConfig['config']['wizards'])
......@@ -1544,8 +1544,8 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select'
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select')
) {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])
......@@ -1631,8 +1631,8 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select'
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select')
) {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])
......@@ -1734,8 +1734,8 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select'
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
|| $fieldConfig['config']['type'] === 'select')
) {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])
......@@ -1924,7 +1924,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'text') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'text') {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])
) {
......@@ -2021,7 +2021,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'text') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'text') {
if (isset($fieldConfig['config']['wizards'])
&& is_array($fieldConfig['config']['wizards'])
) {
......@@ -2136,9 +2136,9 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'group'
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
&& isset($fieldConfig['config']['internal_type'])
&& $fieldConfig['config']['internal_type'] === 'db'
&& $fieldConfig['config']['internal_type'] === 'db')
) {
if (isset($fieldConfig['config']['hideSuggest'])) {
continue;
......@@ -2218,7 +2218,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'group') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'group') {
if (isset($fieldConfig['config']['selectedListStyle'])) {
unset($fieldConfig['config']['selectedListStyle']);
$this->messages[] = 'The \'type\' = \'group\' option \'selectedListStyle\' is obsolete and has been dropped'
......@@ -2293,9 +2293,9 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'select'
if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'select'
&& isset($fieldConfig['config']['renderType'])
&& $fieldConfig['config']['renderType'] === 'selectSingle'
&& $fieldConfig['config']['renderType'] === 'selectSingle')
) {
if (isset($fieldConfig['config']['showIconTable'])) {
if ((bool)$fieldConfig['config']['showIconTable'] === true) {
......@@ -2336,7 +2336,7 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] === 'imageManipulation') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'imageManipulation') {
if (isset($fieldConfig['config']['enableZoom'])) {
unset($fieldConfig['config']['enableZoom']);
$this->messages[] = sprintf(
......@@ -2399,12 +2399,10 @@ class TcaMigration
foreach ($tca as $table => &$tableDefinition) {
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if (isset($fieldConfig['config']['renderType'])) {
if ($fieldConfig['config']['renderType'] === 'inputDateTime') {
if (isset($fieldConfig['config']['max'])) {
unset($fieldConfig['config']['max']);
$this->messages[] = 'The config option \'max\' has been removed from the TCA for renderType=\'inputDateTime\' in ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'max\']';
}
if (isset($fieldConfig['config']['renderType']) && $fieldConfig['config']['renderType'] === 'inputDateTime') {
if (isset($fieldConfig['config']['max'])) {
unset($fieldConfig['config']['max']);
$this->messages[] = 'The config option \'max\' has been removed from the TCA for renderType=\'inputDateTime\' in ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'max\']';
}
}
}
......@@ -2470,7 +2468,7 @@ class TcaMigration
}
if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ($fieldConfig['config']['type'] !== 'inline') {
if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] !== 'inline') {
continue;
}
if (isset($fieldConfig['config']['foreign_types']) && is_array($fieldConfig['config']['foreign_types'])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment