From 9766ab84a9e364e83ac1017b7493f0548124f41b Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Wed, 28 Feb 2024 10:07:25 +0100 Subject: [PATCH] [TASK] Update invalid test data providers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of https://review.typo3.org/c/Packages/TYPO3.CMS/+/83155 to TYPO3 v12. PHPUnit 10.5.18 introduces deprecation warning due to use of non-matching parameter names with data providers, introduced by https://github.com/sebastianbergmann/phpunit/pull/5812. This patch backports changes that were made for PHPUnit v11 support, which also addresses these kind of deprecation warnings too. Resolves: #103634 Related: #103222 Releases: 12.4 Change-Id: Ia9a1f7c5d62894dc80b3d1f9b465fb488b3250fc Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83788 Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Tests/Unit/Utility/StateUtilityTest.php | 16 ++- .../FormDataProvider/TcaCheckboxItemsTest.php | 4 +- .../Tests/Unit/Utility/BackendUtilityTest.php | 23 +--- .../Functional/Command/CliCommandTest.php | 44 +++---- .../DataHandling/Regular/MinValueTest.php | 6 +- .../Functional/Imaging/IconFactoryTest.php | 38 +++--- .../Resource/Driver/LocalDriverTest.php | 6 +- .../Resource/StorageRepositoryTest.php | 60 ++++----- .../Unit/DataHandling/DataHandlerTest.php | 6 +- .../EmailSoftReferenceParserTest.php | 26 ++-- .../ExtensionPathSoftReferenceParserTest.php | 18 +-- .../TypoLinkTagSoftReferenceParserTest.php | 32 ++--- .../UrlSoftReferenceParserTest.php | 40 +++--- .../Localization/Parser/XliffParserTest.php | 30 ++--- .../Unit/Migrations/TcaMigrationTest.php | 14 +- .../Unit/Session/UserSessionManagerTest.php | 6 +- .../FrontendConfigurationManagerTest.php | 10 +- .../ControllerArgumentsMappingTest.php | 21 +-- .../Persistence/QueryLocalizedDataTest.php | 32 ++--- .../Persistence/TranslatedSiteContentTest.php | 6 +- .../Validation/Validator/UrlValidatorTest.php | 4 +- .../Unit/Service/RecoveryServiceTest.php | 124 +++++++++--------- .../LocalizedSiteContentRenderingTest.php | 34 ++--- .../InternalRequestDataMappingTest.php | 6 +- .../LocalizedPageRendering/ScenarioATest.php | 6 +- .../LocalizedPageRendering/ScenarioBTest.php | 4 +- .../LocalizedPageRendering/ScenarioCTest.php | 8 +- .../LocalizedPageRendering/ScenarioDTest.php | 8 +- .../LocalizedPageRendering/ScenarioETest.php | 6 +- .../LocalizedPageRendering/ScenarioFTest.php | 6 +- .../LocalizedPageRendering/ScenarioGTest.php | 2 +- .../SiteHandling/SlugLinkGeneratorTest.php | 46 +++---- .../SiteHandling/SlugSiteRequestTest.php | 40 +++--- .../UpgradeAnalysis/DocumentationFileTest.php | 10 +- .../Format/PhpErrorCodeViewHelperTest.php | 4 +- .../Service/RedirectServiceTest.php | 6 +- 36 files changed, 363 insertions(+), 389 deletions(-) diff --git a/typo3/sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php b/typo3/sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php index 36ce074b0811..5896a8f33948 100644 --- a/typo3/sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php +++ b/typo3/sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php @@ -84,16 +84,20 @@ final class StateUtilityTest extends UnitTestCase [], ], 'all modules disabled' => [ - 'admPanel.' => [ - 'enable.' => [ - 'all' => 0, + [ + 'admPanel.' => [ + 'enable.' => [ + 'all' => 0, + ], ], ], ], 'single module configured, disabled' => [ - 'admPanel.' => [ - 'enable.' => [ - 'preview' => 0, + [ + 'admPanel.' => [ + 'enable.' => [ + 'preview' => 0, + ], ], ], ], diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php index 77b7ae54cf99..fca2cbcf18a4 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php @@ -381,13 +381,13 @@ final class TcaCheckboxItemsTest extends UnitTestCase #[DataProvider('checkboxConfigurationDataProvider')] #[Test] - public function addDataKeepExistingItems(array $input, array $expectedResult): void + public function addDataKeepExistingItems(array $input, array $expected): void { $languageService = $this->createMock(LanguageService::class); $GLOBALS['LANG'] = $languageService; $languageService->method('sL')->with(self::anything())->willReturnArgument(0); - self::assertSame($expectedResult, (new TcaCheckboxItems())->addData($input)); + self::assertSame($expected, (new TcaCheckboxItems())->addData($input)); } #[Test] diff --git a/typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php b/typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php index 61ad9a4d412b..3e4cfe4cb3ac 100644 --- a/typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php +++ b/typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php @@ -37,12 +37,6 @@ final class BackendUtilityTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /////////////////////////////////////// - // Tests concerning calcAge - /////////////////////////////////////// - /** - * Data provider for calcAge function - */ public static function calcAgeDataProvider(): array { return [ @@ -124,12 +118,6 @@ final class BackendUtilityTest extends UnitTestCase self::assertSame($expectedLabel, BackendUtility::calcAge($seconds)); } - /////////////////////////////////////// - // Tests concerning getProcessedValue - /////////////////////////////////////// - /** - * @see https://forge.typo3.org/issues/20994 - */ #[Test] public function getProcessedValueForZeroStringIsZero(): void { @@ -144,9 +132,7 @@ final class BackendUtilityTest extends UnitTestCase ], ], ]; - $GLOBALS['LANG'] = $this->createMock(LanguageService::class); - self::assertEquals('0', BackendUtility::getProcessedValue('tt_content', 'header', '0')); } @@ -587,12 +573,9 @@ final class BackendUtilityTest extends UnitTestCase ]; } - /** - * @param bool|int $input - */ #[DataProvider('inputTypeDateDisplayOptions')] #[Test] - public function getProcessedValueHandlesAgeDisplayCorrectly($input, string $expected): void + public function getProcessedValueHandlesAgeDisplayCorrectly(bool|int $input, string $expected): void { $languageServiceMock = $this->createMock(LanguageService::class); $languageServiceMock->method('sL')->willReturn(' min| hrs| days| yrs| min| hour| day| year'); @@ -907,7 +890,7 @@ final class BackendUtilityTest extends UnitTestCase 'no field found' => [ 'pageId' => 123, 'table' => 'tt_content', - 'col' => 'menu_type', + 'column' => 'menu_type', 'key' => '10', 'tca' => [ 'columns' => [ @@ -927,7 +910,7 @@ final class BackendUtilityTest extends UnitTestCase 'no tsconfig set' => [ 'pageId' => 123, 'table' => 'tt_content', - 'col' => 'menu_type', + 'column' => 'menu_type', 'key' => '1', 'tca' => [ 'columns' => [ diff --git a/typo3/sysext/core/Tests/Functional/Command/CliCommandTest.php b/typo3/sysext/core/Tests/Functional/Command/CliCommandTest.php index 0026862fc333..a9fa642b939c 100644 --- a/typo3/sysext/core/Tests/Functional/Command/CliCommandTest.php +++ b/typo3/sysext/core/Tests/Functional/Command/CliCommandTest.php @@ -50,28 +50,28 @@ final class CliCommandTest extends AbstractCommandTestCase public static function commandTestDataProvider(): array { return [ - ['command' => 'cleanup:localprocessedfiles', 'args' => ['-v'], 'code' => 0], - ['command' => 'cache:flush', 'args' => [], 'code' => 0], - ['command' => 'cache:warmup', 'args' => [], 'code' => 0], - ['command' => 'cleanup:flexforms', 'args' => [], 'code' => 0], - ['command' => 'cleanup:deletedrecords', 'args' => [], 'code' => 0], - ['command' => 'cleanup:orphanrecords', 'args' => [], 'code' => 0], - ['command' => 'cleanup:previewlinks', 'args' => [], 'code' => 0], - ['command' => 'cleanup:versions', 'args' => [], 'code' => 0], - ['command' => 'extension:list', 'args' => [], 'code' => 0], - ['command' => 'extension:setup', 'args' => [], 'code' => 0], - ['command' => 'extension:deactivate workspaces', 'args' => [], 'code' => 0], - ['command' => 'extension:activate workspaces', 'args' => [], 'code' => 0], - ['command' => 'language:update', 'args' => [], 'code' => 0], - ['command' => 'mailer:spool:send', 'args' => [], 'code' => 1], - ['command' => 'redirects:checkintegrity', 'args' => [], 'code' => 0], - ['command' => 'redirects:cleanup', 'args' => [], 'code' => 0], - ['command' => 'referenceindex:update', 'args' => ['--check'], 'code' => 0], - ['command' => 'scheduler:run', 'args' => [], 'code' => 0], - ['command' => 'site:list', 'args' => [], 'code' => 0], - ['command' => 'site:show show-me', 'args' => [], 'code' => 0], - ['command' => 'syslog:list', 'args' => [], 'code' => 0], - ['command' => 'upgrade:list', 'args' => [], 'code' => 0], + ['command' => 'cleanup:localprocessedfiles', 'args' => ['-v'], 'expectedExitCode' => 0], + ['command' => 'cache:flush', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cache:warmup', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cleanup:flexforms', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cleanup:deletedrecords', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cleanup:orphanrecords', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cleanup:previewlinks', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'cleanup:versions', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'extension:list', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'extension:setup', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'extension:deactivate workspaces', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'extension:activate workspaces', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'language:update', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'mailer:spool:send', 'args' => [], 'expectedExitCode' => 1], + ['command' => 'redirects:checkintegrity', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'redirects:cleanup', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'referenceindex:update', 'args' => ['--check'], 'expectedExitCode' => 0], + ['command' => 'scheduler:run', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'site:list', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'site:show show-me', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'syslog:list', 'args' => [], 'expectedExitCode' => 0], + ['command' => 'upgrade:list', 'args' => [], 'expectedExitCode' => 0], ]; } diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php index c63bbe5cb765..fbd409659ada 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/MinValueTest.php @@ -68,13 +68,13 @@ final class MinValueTest extends FunctionalTestCase #[DataProvider('valuesLowerThanMinResetToEmptyStringDataProvider')] #[Test] - public function valuesLowerThanMinResetToEmptyString(string $string, string $expected): void + public function valuesLowerThanMinResetToEmptyString(string $value, string $expected): void { // Should work for type=input and type=text (except RTE). $actionService = new ActionService(); $map = $actionService->createNewRecord('tt_content', 1, [ - 'tx_testdatahandler_input_minvalue' => $string, - 'tx_testdatahandler_text_minvalue' => $string, + 'tx_testdatahandler_input_minvalue' => $value, + 'tx_testdatahandler_text_minvalue' => $value, ]); $newRecordId = reset($map['tt_content']); $newRecord = BackendUtility::getRecord('tt_content', $newRecordId); diff --git a/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php b/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php index d2633c8177d2..ad2b7ee4d2a3 100644 --- a/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php +++ b/typo3/sysext/core/Tests/Functional/Imaging/IconFactoryTest.php @@ -30,15 +30,15 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; final class IconFactoryTest extends FunctionalTestCase { - protected IconFactory $subject; - protected string $notRegisteredIconIdentifier = 'my-super-unregistered-identifier'; - protected string $registeredIconIdentifier = 'actions-close'; - protected string $registeredSpinningIconIdentifier = 'spinning-icon'; + private IconFactory $subject; + private string $notRegisteredIconIdentifier = 'my-super-unregistered-identifier'; + private string $registeredIconIdentifier = 'actions-close'; + private string $registeredSpinningIconIdentifier = 'spinning-icon'; /** * Simulate a tt_content record */ - protected array $mockRecord = [ + private array $mockRecord = [ 'header' => 'dummy content header', 'uid' => '1', 'pid' => '1', @@ -68,10 +68,10 @@ final class IconFactoryTest extends FunctionalTestCase public static function differentSizesDataProvider(): array { return [ - ['size ' . Icon::SIZE_DEFAULT => ['input' => Icon::SIZE_DEFAULT, 'expected' => Icon::SIZE_DEFAULT]], - ['size ' . Icon::SIZE_SMALL => ['input' => Icon::SIZE_SMALL, 'expected' => Icon::SIZE_SMALL]], - ['size ' . Icon::SIZE_MEDIUM => ['input' => Icon::SIZE_MEDIUM, 'expected' => Icon::SIZE_MEDIUM]], - ['size ' . Icon::SIZE_LARGE => ['input' => Icon::SIZE_LARGE, 'expected' => Icon::SIZE_LARGE]], + 'size ' . Icon::SIZE_DEFAULT => ['size' => Icon::SIZE_DEFAULT, 'expected' => Icon::SIZE_DEFAULT], + 'size ' . Icon::SIZE_SMALL => ['size' => Icon::SIZE_SMALL, 'expected' => Icon::SIZE_SMALL], + 'size ' . Icon::SIZE_MEDIUM => ['size' => Icon::SIZE_MEDIUM, 'expected' => Icon::SIZE_MEDIUM], + 'size ' . Icon::SIZE_LARGE => ['size' => Icon::SIZE_LARGE, 'expected' => Icon::SIZE_LARGE], ]; } @@ -95,21 +95,21 @@ final class IconFactoryTest extends FunctionalTestCase #[DataProvider('differentSizesDataProvider')] #[Test] - public function getIconByIdentifierAndSizeReturnsIconWithCorrectMarkupIfRegisteredIconIdentifierIsUsed($size): void + public function getIconByIdentifierAndSizeReturnsIconWithCorrectMarkupIfRegisteredIconIdentifierIsUsed(string $size, string $expected): void { self::assertStringContainsString( - '<span class="t3js-icon icon icon-size-' . $size['expected'] . ' icon-state-default icon-actions-close" data-identifier="actions-close" aria-hidden="true">', - $this->subject->getIcon($this->registeredIconIdentifier, $size['input'])->render() + '<span class="t3js-icon icon icon-size-' . $expected . ' icon-state-default icon-actions-close" data-identifier="actions-close" aria-hidden="true">', + $this->subject->getIcon($this->registeredIconIdentifier, $size)->render() ); } #[DataProvider('differentSizesDataProvider')] #[Test] - public function getIconByIdentifierAndSizeAndWithOverlayReturnsIconWithCorrectOverlayMarkupIfRegisteredIconIdentifierIsUsed($size): void + public function getIconByIdentifierAndSizeAndWithOverlayReturnsIconWithCorrectOverlayMarkupIfRegisteredIconIdentifierIsUsed(string $size, string $expected): void { self::assertStringContainsString( '<span class="icon-overlay icon-overlay-readonly">', - $this->subject->getIcon($this->registeredIconIdentifier, $size['input'], 'overlay-readonly')->render() + $this->subject->getIcon($this->registeredIconIdentifier, $size, 'overlay-readonly')->render() ); } @@ -124,11 +124,11 @@ final class IconFactoryTest extends FunctionalTestCase #[DataProvider('differentSizesDataProvider')] #[Test] - public function getIconByIdentifierAndSizeReturnsNotFoundIconWithCorrectMarkupIfUnregisteredIdentifierIsUsed(array $size): void + public function getIconByIdentifierAndSizeReturnsNotFoundIconWithCorrectMarkupIfUnregisteredIdentifierIsUsed(string $size, string $expected): void { self::assertStringContainsString( - '<span class="t3js-icon icon icon-size-' . $size['expected'] . ' icon-state-default icon-default-not-found" data-identifier="default-not-found" aria-hidden="true">', - $this->subject->getIcon($this->notRegisteredIconIdentifier, $size['input'])->render() + '<span class="t3js-icon icon icon-size-' . $expected . ' icon-state-default icon-default-not-found" data-identifier="default-not-found" aria-hidden="true">', + $this->subject->getIcon($this->notRegisteredIconIdentifier, $size)->render() ); } @@ -152,11 +152,11 @@ final class IconFactoryTest extends FunctionalTestCase #[DataProvider('differentSizesDataProvider')] #[Test] - public function getIconByIdentifierAndSizeAndOverlayReturnsNotFoundIconWithCorrectMarkupIfUnregisteredIdentifierIsUsed(array $size): void + public function getIconByIdentifierAndSizeAndOverlayReturnsNotFoundIconWithCorrectMarkupIfUnregisteredIdentifierIsUsed(string $size, string $expected): void { self::assertStringContainsString( '<span class="icon-overlay icon-overlay-readonly">', - $this->subject->getIcon($this->notRegisteredIconIdentifier, $size['input'], 'overlay-readonly')->render() + $this->subject->getIcon($this->notRegisteredIconIdentifier, $size, 'overlay-readonly')->render() ); } diff --git a/typo3/sysext/core/Tests/Functional/Resource/Driver/LocalDriverTest.php b/typo3/sysext/core/Tests/Functional/Resource/Driver/LocalDriverTest.php index 6e3fb4746216..893d341b49e3 100644 --- a/typo3/sysext/core/Tests/Functional/Resource/Driver/LocalDriverTest.php +++ b/typo3/sysext/core/Tests/Functional/Resource/Driver/LocalDriverTest.php @@ -349,15 +349,15 @@ final class LocalDriverTest extends FunctionalTestCase #[DataProvider('getSpecificFileInformationDataProvider')] #[Test] - public function getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $property): void + public function getSpecificFileInformationReturnsRequestedFileInformation(string|int $expectedValue, string $propertyName): void { copy(__DIR__ . '/Fixtures/Dummy.html', $this->baseDirectory . '/Dummy.html'); - if (in_array($property, ['mtime', 'ctime', 'atime'])) { + if (in_array($propertyName, ['mtime', 'ctime', 'atime'])) { $expectedValue = filemtime($this->baseDirectory . '/Dummy.html'); } $subject = $this->getDefaultInitializedSubject(); $subject->setStorageUid(5); - self::assertSame($expectedValue, $subject->getSpecificFileInformation($this->baseDirectory . '/Dummy.html', '/', $property)); + self::assertSame($expectedValue, $subject->getSpecificFileInformation($this->baseDirectory . '/Dummy.html', '/', $propertyName)); } #[Test] diff --git a/typo3/sysext/core/Tests/Functional/Resource/StorageRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Resource/StorageRepositoryTest.php index f43d60b94276..49bde3a09b72 100644 --- a/typo3/sysext/core/Tests/Functional/Resource/StorageRepositoryTest.php +++ b/typo3/sysext/core/Tests/Functional/Resource/StorageRepositoryTest.php @@ -164,46 +164,46 @@ final class StorageRepositoryTest extends FunctionalTestCase { return [ 'Access to file in ro file mount denied for write request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'fooBaz', - '$isFileMountReadOnly' => true, - '$checkWriteAccess' => true, - '$expectedResult' => false, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'fooBaz', + 'isFileMountReadOnly' => true, + 'checkWriteAccess' => true, + 'expectedResult' => false, ], 'Access to file in ro file mount allowed for read request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'fooBaz', - '$isFileMountReadOnly' => true, - '$checkWriteAccess' => false, - '$expectedResult' => true, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'fooBaz', + 'isFileMountReadOnly' => true, + 'checkWriteAccess' => false, + 'expectedResult' => true, ], 'Access to file in rw file mount allowed for write request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'fooBaz', - '$isFileMountReadOnly' => false, - '$checkWriteAccess' => true, - '$expectedResult' => true, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'fooBaz', + 'isFileMountReadOnly' => false, + 'checkWriteAccess' => true, + 'expectedResult' => true, ], 'Access to file in rw file mount allowed for read request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'fooBaz', - '$isFileMountReadOnly' => false, - '$checkWriteAccess' => false, - '$expectedResult' => true, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'fooBaz', + 'isFileMountReadOnly' => false, + 'checkWriteAccess' => false, + 'expectedResult' => true, ], 'Access to file not in file mount denied for write request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'barBaz', - '$isFileMountReadOnly' => false, - '$checkWriteAccess' => true, - '$expectedResult' => false, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'barBaz', + 'isFileMountReadOnly' => false, + 'checkWriteAccess' => true, + 'expectedResult' => false, ], 'Access to file not in file mount denied for read request' => [ - '$targetDirectory' => 'fooBaz', - '$fileMountFolder' => 'barBaz', - '$isFileMountReadOnly' => false, - '$checkWriteAccess' => false, - '$expectedResult' => false, + 'targetDirectory' => 'fooBaz', + 'fileMountFolder' => 'barBaz', + 'isFileMountReadOnly' => false, + 'checkWriteAccess' => false, + 'expectedResult' => false, ], ]; } diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php index d4d1300c881f..4a67a3ae59ef 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php @@ -285,14 +285,14 @@ final class DataHandlerTest extends UnitTestCase #[DataProvider('numberValueCheckRecognizesDecimalStringValuesAsFloatValuesCorrectlyDataProvider')] #[Test] - public function numberValueCheckRecognizesDecimalStringValuesAsFloatValuesCorrectly(string $value, string $expectedReturnValue): void + public function numberValueCheckRecognizesDecimalStringValuesAsFloatValuesCorrectly(string $input, string $expected): void { $tcaFieldConf = [ 'type' => 'number', 'format' => 'decimal', ]; - $returnValue = $this->subject->_call('checkValueForNumber', $value, $tcaFieldConf); - self::assertSame($expectedReturnValue, $returnValue['value']); + $returnValue = $this->subject->_call('checkValueForNumber', $input, $tcaFieldConf); + self::assertSame($expected, $returnValue['value']); } /** diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/EmailSoftReferenceParserTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/EmailSoftReferenceParserTest.php index 77d7cdbb4a4f..960286960ac8 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/EmailSoftReferenceParserTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/EmailSoftReferenceParserTest.php @@ -26,19 +26,19 @@ final class EmailSoftReferenceParserTest extends AbstractSoftReferenceParserTest { return [ 'Simple email address found' => [ - 'foo@bar.baz', 'content' => 'foo@bar.baz', - 'elements' => [ + 'expectedContent' => 'foo@bar.baz', + 'expectedElements' => [ 2 => [ 'matchString' => 'foo@bar.baz', ], ], - 'hasMatched' => true, + 'expectedHasMatched' => true, ], 'Multiple email addresses found' => [ - 'This is my first email: foo@bar.baz and this is my second email: foo-_2@bar.baz', 'content' => 'This is my first email: foo@bar.baz and this is my second email: foo-_2@bar.baz', - 'elements' => [ + 'expectedContent' => 'This is my first email: foo@bar.baz and this is my second email: foo-_2@bar.baz', + 'expectedElements' => [ 2 => [ 'matchString' => 'foo@bar.baz', ], @@ -46,10 +46,10 @@ final class EmailSoftReferenceParserTest extends AbstractSoftReferenceParserTest 'matchString' => 'foo-_2@bar.baz', ], ], - 'hasMatched' => true, + 'expectedHasMatched' => true, ], 'Invalid emails are ignored' => [ - 'abc-@mail.com + 'content' => 'abc-@mail.com abc..def@mail.com .abc@mail.com abc#def@mail.com @@ -57,14 +57,14 @@ final class EmailSoftReferenceParserTest extends AbstractSoftReferenceParserTest abc.def@mail#archive.com abc.def@mail abc.def@mail..com', - 'content' => '', - 'elements' => [], - 'hasMatched' => false, + 'expectedContent' => '', + 'expectedElements' => [], + 'expectedHasMatched' => false, ], 'E-Mails in html match' => [ - '<a href="mailto:foo@bar.de">foo@bar.baz</a>', 'content' => '<a href="mailto:foo@bar.de">foo@bar.baz</a>', - 'elements' => [ + 'expectedContent' => '<a href="mailto:foo@bar.de">foo@bar.baz</a>', + 'expectedElements' => [ 2 => [ 'matchString' => 'foo@bar.de', ], @@ -72,7 +72,7 @@ final class EmailSoftReferenceParserTest extends AbstractSoftReferenceParserTest 'matchString' => 'foo@bar.baz', ], ], - 'hasMatched' => true, + 'expectedHasMatched' => true, ], ]; } diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/ExtensionPathSoftReferenceParserTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/ExtensionPathSoftReferenceParserTest.php index 59d42f172df5..547a41aa8935 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/ExtensionPathSoftReferenceParserTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/ExtensionPathSoftReferenceParserTest.php @@ -28,12 +28,12 @@ final class ExtensionPathSoftReferenceParserTest extends AbstractSoftReferencePa 'Simple EXT: path has a match' => [ 'text' => 'EXT:foobar/Configuration/TypoScript/setup.typoscript', 'content' => 'EXT:foobar/Configuration/TypoScript/setup.typoscript', - 'elements' => [ + 'expectedElements' => [ 2 => [ 'matchString' => 'EXT:foobar/Configuration/TypoScript/setup.typoscript', ], ], - 'hasMatched' => true, + 'expectedHasMatched' => true, ], 'Multiple EXT: paths have matches' => [ 'text' => ' @@ -48,7 +48,7 @@ final class ExtensionPathSoftReferenceParserTest extends AbstractSoftReferencePa @import "EXT:foobar/Configuration/TypoScript/setup2.typoscript" # some comment ', - 'elements' => [ + 'expectedElements' => [ 2 => [ 'matchString' => 'EXT:foobar/Configuration/TypoScript/setup1.typoscript', ], @@ -56,24 +56,24 @@ final class ExtensionPathSoftReferenceParserTest extends AbstractSoftReferencePa 'matchString' => 'EXT:foobar/Configuration/TypoScript/setup2.typoscript', ], ], - 'hasMatched' => true, + 'expectedHasMatched' => true, ], 'No matches returns null' => [ 'text' => '/foobar/Configuration/TypoScript/setup.typoscript', 'content' => '', - 'elements' => [], - 'hasMatched' => false, + 'expectedElements' => [], + 'expectedHasMatched' => false, ], ]; } #[DataProvider('extensionPathSoftReferenceParserDataProvider')] #[Test] - public function extensionPathSoftReferenceParserTest(string $content, string $expectedContent, array $expectedElements, bool $expectedHasMatched): void + public function extensionPathSoftReferenceParserTest(string $text, string $content, array $expectedElements, bool $expectedHasMatched): void { $subject = $this->getParserByKey('ext_fileref'); - $result = $subject->parse('sys_template', 'include_static_file', 1, $content); - self::assertSame($expectedContent, $result->getContent()); + $result = $subject->parse('sys_template', 'include_static_file', 1, $text); + self::assertSame($content, $result->getContent()); self::assertSame($expectedElements, $result->getMatchedElements()); self::assertSame($expectedHasMatched, $result->hasMatched()); } diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkTagSoftReferenceParserTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkTagSoftReferenceParserTest.php index 7b9a7a2a56e2..eb651555c08d 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkTagSoftReferenceParserTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/TypoLinkTagSoftReferenceParserTest.php @@ -30,12 +30,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars { return [ 'link to page' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a href="t3://page?uid=42">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a href="t3://page?uid=42">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'db', 'recordRef' => 'pages:42', @@ -44,12 +44,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to page with properties' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a class="link-page" href="t3://page?uid=42" target="_top" title="Foo">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a class="link-page" href="t3://page?uid=42" target="_top" title="Foo">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'db', 'recordRef' => 'pages:42', @@ -58,12 +58,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to external URL without scheme' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a class="link-page" href="www.example.com" target="_top" title="Foo">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a class="link-page" href="www.example.com" target="_top" title="Foo">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'external', 'tokenValue' => 'http://www.example.com', @@ -71,12 +71,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to external URL with scheme' => [ - 'typolink_tag' => [ + 'softrefConfiguration' => [ 'content' => '<p><a class="link-page" href="https://www.example.com" target="_top" title="Foo">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a class="link-page" href="https://www.example.com" target="_top" title="Foo">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'external', 'tokenValue' => 'https://www.example.com', @@ -84,12 +84,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to email' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a href="mailto:test@example.com">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a href="mailto:test@example.com">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'string', 'tokenValue' => 'test@example.com', @@ -97,12 +97,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to email without schema' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a href="test@example.com">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a href="test@example.com">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'string', 'tokenValue' => 'test@example.com', @@ -110,12 +110,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link to phone number' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a href="tel:0123456789">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a href="tel:0123456789">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'string', 'tokenValue' => '0123456789', @@ -123,12 +123,12 @@ final class TypoLinkTagSoftReferenceParserTest extends AbstractSoftReferencePars ], ], 'link with invalid content' => [ - [ + 'softrefConfiguration' => [ 'content' => '<p><a href="Email: hans@example.com">Click here</a></p>', 'elementKey' => 1, 'matchString' => '<a href="Email: hans@example.com">', ], - [ + 'expectedElement' => [ 'subst' => [ 'type' => 'string', 'tokenValue' => '', diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php index bcf625ecbd30..2c3fd22f99ec 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php @@ -26,63 +26,63 @@ final class UrlSoftReferenceParserTest extends AbstractSoftReferenceParserTestCa { return [ 'Simple url matches' => [ - 'https://foo-bar.baz', 'content' => 'https://foo-bar.baz', - 'elements' => [ + 'expectedContent' => 'https://foo-bar.baz', + 'expectedElements' => [ 2 => [ 'matchString' => 'https://foo-bar.baz', ], ], ], 'Valid characters by RFC 3986 match' => [ - 'http://ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&\'()*+,;=.foo', 'content' => 'http://ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&\'()*+,;=.foo', - 'elements' => [ + 'expectedContent' => 'http://ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&\'()*+,;=.foo', + 'expectedElements' => [ 2 => [ 'matchString' => 'http://ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&\'()*+,;=.foo', ], ], ], 'URLs in content match' => [ - 'Lorem ipsum https://foo-bar.baz dolor sit', 'content' => 'Lorem ipsum https://foo-bar.baz dolor sit', - 'elements' => [ + 'expectedContent' => 'Lorem ipsum https://foo-bar.baz dolor sit', + 'expectedElements' => [ 2 => [ 'matchString' => 'https://foo-bar.baz', ], ], ], 'FTP URLs match' => [ - 'ftp://foo-bar.baz', 'content' => 'ftp://foo-bar.baz', - 'elements' => [ + 'expectedContent' => 'ftp://foo-bar.baz', + 'expectedElements' => [ 2 => [ 'matchString' => 'ftp://foo-bar.baz', ], ], ], 'Full URLs match' => [ - 'https://foo-bar.baz?foo=bar&baz=fizz#anchor', 'content' => 'https://foo-bar.baz?foo=bar&baz=fizz#anchor', - 'elements' => [ + 'expectedContent' => 'https://foo-bar.baz?foo=bar&baz=fizz#anchor', + 'expectedElements' => [ 2 => [ 'matchString' => 'https://foo-bar.baz?foo=bar&baz=fizz#anchor', ], ], ], 'URL encoded URLs match' => [ - 'https://foo-bar.baz?foo%3Dbar%26baz%3Dfi%20zz%23anchor', 'content' => 'https://foo-bar.baz?foo%3Dbar%26baz%3Dfi%20zz%23anchor', - 'elements' => [ + 'expectedContent' => 'https://foo-bar.baz?foo%3Dbar%26baz%3Dfi%20zz%23anchor', + 'expectedElements' => [ 2 => [ 'matchString' => 'https://foo-bar.baz?foo%3Dbar%26baz%3Dfi%20zz%23anchor', ], ], ], 'No space character after the last URL matches' => [ - '<p>Lorem Ipsum<br> https://foo.bar.baz/abc/def/ghi/.</p>', 'content' => '<p>Lorem Ipsum<br> https://foo.bar.baz/abc/def/ghi/.</p>', - 'elements' => [ + 'expectedContent' => '<p>Lorem Ipsum<br> https://foo.bar.baz/abc/def/ghi/.</p>', + 'expectedElements' => [ 2 => [ 'matchString' => 'https://foo.bar.baz/abc/def/ghi/.', ], @@ -90,14 +90,14 @@ final class UrlSoftReferenceParserTest extends AbstractSoftReferenceParserTestCa ], // The two cases below are handled by typolink_tag 'URLs in anchor tag attributes do NOT match' => [ - '<a href="https://foo-bar.baz">some link</a>', - 'content' => '', - 'elements' => [], + 'content' => '<a href="https://foo-bar.baz">some link</a>', + 'expectedContent' => '', + 'expectedElements' => [], ], 'URLs in link tag attributes do NOT match' => [ - '<link href="https://foo-bar.baz/style.css" rel="stylesheet">', - 'content' => '', - 'elements' => [], + 'content' => '<link href="https://foo-bar.baz/style.css" rel="stylesheet">', + 'expectedContent' => '', + 'expectedElements' => [], ], ]; } diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php b/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php index 1385ae7395c3..43d881f1e08c 100644 --- a/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php +++ b/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php @@ -24,18 +24,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; final class XliffParserTest extends UnitTestCase { - #[DataProvider('canParseXliffDataProvider')] - #[Test] - public function canParseXliff(string $languageKey, array $expectedLabels, bool $requireApprovedLocalizations): void - { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['requireApprovedLocalizations'] = $requireApprovedLocalizations; - $LOCAL_LANG = (new XliffParser())->getParsedData(__DIR__ . '/Fixtures/locallang.xlf', $languageKey); - self::assertArrayHasKey($languageKey, $LOCAL_LANG, sprintf('%s key not found in $LOCAL_LANG', $languageKey)); - foreach ($expectedLabels as $key => $expectedLabel) { - self::assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']); - } - } - public static function canParseXliffDataProvider(): \Generator { yield 'Can handle default' => [ @@ -45,14 +33,14 @@ final class XliffParserTest extends UnitTestCase 'label2' => 'This is label #2', 'label3' => 'This is label #3', ], - false, + 'requireApprovedLocalizations' => false, ]; yield 'Can handle translation with approved only' => [ 'languageKey' => 'fr', 'expectedLabels' => [ 'label2' => 'Ceci est le libellé no. 2 [approved]', ], - true, + 'requireApprovedLocalizations' => true, ]; yield 'Can handle translation with non approved' => [ 'languageKey' => 'fr', @@ -61,7 +49,19 @@ final class XliffParserTest extends UnitTestCase 'label2' => 'Ceci est le libellé no. 2 [approved]', 'label3' => 'Ceci est le libellé no. 3 [not approved]', ], - false, + 'requireApprovedLocalizations' => false, ]; } + + #[DataProvider('canParseXliffDataProvider')] + #[Test] + public function canParseXliff(string $languageKey, array $expectedLabels, bool $requireApprovedLocalizations): void + { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['requireApprovedLocalizations'] = $requireApprovedLocalizations; + $LOCAL_LANG = (new XliffParser())->getParsedData(__DIR__ . '/Fixtures/locallang.xlf', $languageKey); + self::assertArrayHasKey($languageKey, $LOCAL_LANG, sprintf('%s key not found in $LOCAL_LANG', $languageKey)); + foreach ($expectedLabels as $key => $expectedLabel) { + self::assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']); + } + } } diff --git a/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php b/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php index afae6f624d96..c1d9bc3e5d62 100644 --- a/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php +++ b/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php @@ -1411,10 +1411,10 @@ final class TcaMigrationTest extends UnitTestCase #[DataProvider('requiredFlagIsMigratedDataProvider')] #[Test] - public function requiredFlagIsMigrated(array $input, array $expected): void + public function requiredFlagIsMigrated(array $tca, array $expected): void { $subject = new TcaMigration(); - self::assertEquals($expected, $subject->migrate($input)); + self::assertEquals($expected, $subject->migrate($tca)); } public static function evalNullMigratedToNullableOptionDataProvider(): iterable @@ -1528,15 +1528,15 @@ final class TcaMigrationTest extends UnitTestCase } /** - * @param array<string, mixed> $input + * @param array<string, mixed> $tca * @param array<string, mixed> $expected */ #[DataProvider('evalNullMigratedToNullableOptionDataProvider')] #[Test] - public function evalNullMigratedToNullableOption(array $input, array $expected): void + public function evalNullMigratedToNullableOption(array $tca, array $expected): void { $subject = new TcaMigration(); - self::assertSame($expected, $subject->migrate($input)); + self::assertSame($expected, $subject->migrate($tca)); } public static function evalEmailMigratedToTypeDataProvider(): iterable @@ -2747,10 +2747,10 @@ final class TcaMigrationTest extends UnitTestCase #[DataProvider('selectIndividualAllowDenyMigratedToNewPositionDataProvider')] #[Test] - public function selectIndividualAllowDenyMigratedToNewPosition(array $input, array $expected): void + public function selectIndividualAllowDenyMigratedToNewPosition(array $tca, array $expected): void { $subject = new TcaMigration(); - self::assertEquals($expected, $subject->migrate($input)); + self::assertEquals($expected, $subject->migrate($tca)); } public static function renderTypeColorpickerToTypeColorDataProvider(): iterable diff --git a/typo3/sysext/core/Tests/Unit/Session/UserSessionManagerTest.php b/typo3/sysext/core/Tests/Unit/Session/UserSessionManagerTest.php index 4a795b6f99fb..76ff387ea008 100644 --- a/typo3/sysext/core/Tests/Unit/Session/UserSessionManagerTest.php +++ b/typo3/sysext/core/Tests/Unit/Session/UserSessionManagerTest.php @@ -40,17 +40,17 @@ final class UserSessionManagerTest extends UnitTestCase [ 'sessionLifetime' => 120, 'gracePeriod' => 120, - 'shouldBeMarkedAsExpired' => true, + 'expectedResult' => true, ], [ 'sessionLifetime' => 120, 'gracePeriod' => 60, - 'shouldBeMarkedAsExpired' => false, + 'expectedResult' => false, ], [ 'sessionLifetime' => 120, 'gracePeriod' => 240, - 'shouldBeMarkedAsExpired' => true, + 'expectedResult' => true, ], ]; } diff --git a/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php index f077fce68a93..2d6882ae02b2 100644 --- a/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Configuration/FrontendConfigurationManagerTest.php @@ -110,7 +110,7 @@ final class FrontendConfigurationManagerTest extends FunctionalTestCase ], ], ], - [ + 'expected' => [ 'booleanField' => '1', ], ]; @@ -345,16 +345,16 @@ final class FrontendConfigurationManagerTest extends FunctionalTestCase #[DataProvider('overrideConfigurationFromFlexFormSettingsDataProvider')] #[Test] public function overrideConfigurationFromFlexFormIgnoresConfiguredEmptyFlexFormSettings( - string $flexFormConfiguration, - array $frameworkConfiguration, + string $flexForm, + array $typoScript, array $expected ): void { $frontendTypoScript = new FrontendTypoScript(new RootNode(), []); - $frontendTypoScript->setSetupArray($frameworkConfiguration); + $frontendTypoScript->setSetupArray($typoScript); $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('frontend.typoscript', $frontendTypoScript); $contentObject = new ContentObjectRenderer(); - $contentObject->data = ['pi_flexform' => $flexFormConfiguration]; + $contentObject->data = ['pi_flexform' => $flexForm]; $frontendConfigurationManager = $this->get(FrontendConfigurationManager::class); $frontendConfigurationManager->setContentObject($contentObject); $frontendConfigurationManager->setConfiguration(['extensionName' => 'foo', 'pluginName' => 'foo']); diff --git a/typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php b/typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php index fafb209f6c8c..52efdac0f784 100644 --- a/typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php @@ -19,7 +19,6 @@ namespace TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; @@ -33,20 +32,8 @@ use TYPO3Tests\BlogExample\Controller\BlogController; final class ControllerArgumentsMappingTest extends FunctionalTestCase { - /** - * @var Request - */ - protected $request; - - /** - * @var ResponseInterface - */ - protected $response; - - /** - * @var BlogController - */ - protected $controller; + private Request $request; + private BlogController $controller; protected array $testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example']; @@ -81,12 +68,12 @@ final class ControllerArgumentsMappingTest extends FunctionalTestCase [ 'language' => 0, 'blogUid' => 1, - 'blogTitle' => 'Blog 1', + 'expectedTitle' => 'Blog 1', ], [ 'language' => 1, 'blogUid' => 1, - 'blogTitle' => 'Blog 1 DA', + 'expectedTitle' => 'Blog 1 DA', ], ]; } diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/QueryLocalizedDataTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/QueryLocalizedDataTest.php index a550ed56fd18..8080625a693d 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/QueryLocalizedDataTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/QueryLocalizedDataTest.php @@ -475,17 +475,17 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ]; return [ [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_MIXED, 'expected' => $lang0Expected, ], [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => $lang0Expected, ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_MIXED, 'expected' => [ [ @@ -594,7 +594,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], 'only fetch records with l10n_parent and try overlays' => [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_ON, // here we have only 4 items instead of 5 as post "Post DA only" uid:15 has no language 0 parent, // so with overlay enabled it's not shown @@ -680,7 +680,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => [ [ @@ -846,22 +846,22 @@ final class QueryLocalizedDataTest extends FunctionalTestCase return [ [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_MIXED, 'expected' => $lang0Expected, ], [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_ON_WITH_FLOATING, 'expected' => $lang0Expected, ], [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => $lang0Expected, ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_MIXED, 'expected' => [ [ @@ -897,7 +897,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_ON, 'expected' => [ [ @@ -918,7 +918,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_ON_WITH_FLOATING, 'expected' => [ [ @@ -954,7 +954,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => [ [ @@ -1038,17 +1038,17 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ]; return [ 'default with overlays' => [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_ON, 'expected' => $allLanguages, ], 'default without overlays, show all languages' => [ - 'language' => 0, + 'languageUid' => 0, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => $allLanguages, ], 'DA with overlays, shows translated records twice (which is a bug)' => [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_ON, 'expected' => [ [ @@ -1064,7 +1064,7 @@ final class QueryLocalizedDataTest extends FunctionalTestCase ], ], 'DA without overlays, queries DA language directly' => [ - 'language' => 1, + 'languageUid' => 1, 'overlay' => LanguageAspect::OVERLAYS_OFF, 'expected' => $allLanguages, ], diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/TranslatedSiteContentTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/TranslatedSiteContentTest.php index c434bf39bd2d..9a581d8046af 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/TranslatedSiteContentTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/TranslatedSiteContentTest.php @@ -557,7 +557,7 @@ final class TranslatedSiteContentTest extends AbstractDataHandlerActionTestCase */ #[DataProvider('contentOnPartiallyTranslatedPageDataProvider')] #[Test] - public function contentOnPartiallyTranslatedPage(string $fallbackType, array $fallbackChain, array $visibleHeaders): void + public function contentOnPartiallyTranslatedPage(string $fallbackType, array $fallbackChain, array $visibleRecordHeaders): void { $this->writeSiteConfiguration( 'test', @@ -582,14 +582,14 @@ final class TranslatedSiteContentTest extends AbstractDataHandlerActionTestCase $this->getRequestSectionHasRecordConstraint() ->setTable(self::TABLE_Content) ->setField('header') - ->setValues(...$visibleHeaders) + ->setValues(...$visibleRecordHeaders) ); self::assertThat( $responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint() ->setTable(self::TABLE_Content) ->setField('header') - ->setValues(...$this->getNonVisibleHeaders($visibleHeaders)) + ->setValues(...$this->getNonVisibleHeaders($visibleRecordHeaders)) ); } diff --git a/typo3/sysext/extbase/Tests/Functional/Validation/Validator/UrlValidatorTest.php b/typo3/sysext/extbase/Tests/Functional/Validation/Validator/UrlValidatorTest.php index 53f53254059d..403b87abfe7a 100644 --- a/typo3/sysext/extbase/Tests/Functional/Validation/Validator/UrlValidatorTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Validation/Validator/UrlValidatorTest.php @@ -111,10 +111,10 @@ final class UrlValidatorTest extends FunctionalTestCase #[DataProvider('urlDataProvider')] #[Test] - public function urlValidatorDetectsUrlsCorrectly($value, $expected): void + public function urlValidatorDetectsUrlsCorrectly($value, $isValid): void { $validator = new UrlValidator(); $validator->setOptions([]); - self::assertSame($expected, !$validator->validate($value)->hasErrors()); + self::assertSame($isValid, !$validator->validate($value)->hasErrors()); } } diff --git a/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php b/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php index 94abd71aaa2b..dbdfcb40c82a 100644 --- a/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php +++ b/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php @@ -62,67 +62,6 @@ final class RecoveryServiceTest extends UnitTestCase $this->extbaseRequest = new Request($request); } - #[DataProvider('configurationDataProvider')] - #[Test] - public function sendRecoveryEmailShouldGenerateMailFromConfiguration( - int $uid, - array $recoveryConfiguration, - array $userData, - Address $receiver, - array $settings - ): void { - $this->mockRecoveryConfigurationAndUserRepository( - $uid, - $recoveryConfiguration, - $userData - ); - - $expectedViewVariables = [ - 'receiverName' => $receiver->getName(), - 'url' => 'some uri', - 'validUntil' => date($settings['dateFormat'], $recoveryConfiguration['lifeTimeTimestamp']), - ]; - - $configurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor() - ->getMock(); - $configurationManager->method('getConfiguration')->with(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) - ->willReturn($settings); - - $uriBuilder = $this->getMockBuilder(UriBuilder::class)->disableOriginalConstructor()->getMock(); - $uriBuilder->expects(self::once())->method('reset')->willReturn($uriBuilder); - $uriBuilder->expects(self::once())->method('setRequest')->with($this->extbaseRequest)->willReturn($uriBuilder); - $uriBuilder->expects(self::once())->method('setCreateAbsoluteUri')->with(true)->willReturn($uriBuilder); - $uriBuilder->expects(self::once())->method('uriFor')->with( - 'showChangePassword', - ['hash' => $recoveryConfiguration['forgotHash']], - 'PasswordRecovery', - 'felogin', - 'Login' - )->willReturn('some uri'); - - $fluidEmailMock = $this->setupFluidEmailMock($receiver, $expectedViewVariables, $recoveryConfiguration); - - $mailer = $this->getMockBuilder(MailerInterface::class)->disableOriginalConstructor()->getMock(); - $mailer->expects(self::once())->method('send')->with($fluidEmailMock); - - $eventDispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)->getMock(); - $subject = $this->getMockBuilder(RecoveryService::class) - ->onlyMethods(['getEmailSubject']) - ->setConstructorArgs( - [ - $mailer, - $eventDispatcherMock, - $configurationManager, - $this->recoveryConfiguration, - $uriBuilder, - $this->userRepository, - ] - )->getMock(); - $subject->method('getEmailSubject')->willReturn('translation'); - - $subject->sendRecoveryEmail($this->extbaseRequest, $userData, $recoveryConfiguration['forgotHash']); - } - public static function configurationDataProvider(): \Generator { yield 'minimal configuration' => [ @@ -227,7 +166,68 @@ final class RecoveryServiceTest extends UnitTestCase ]; } - protected function mockRecoveryConfigurationAndUserRepository( + #[DataProvider('configurationDataProvider')] + #[Test] + public function sendRecoveryEmailShouldGenerateMailFromConfiguration( + int $uid, + array $recoveryConfiguration, + array $userInformation, + Address $receiver, + array $settings + ): void { + $this->mockRecoveryConfigurationAndUserRepository( + $uid, + $recoveryConfiguration, + $userInformation + ); + + $expectedViewVariables = [ + 'receiverName' => $receiver->getName(), + 'url' => 'some uri', + 'validUntil' => date($settings['dateFormat'], $recoveryConfiguration['lifeTimeTimestamp']), + ]; + + $configurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor() + ->getMock(); + $configurationManager->method('getConfiguration')->with(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) + ->willReturn($settings); + + $uriBuilder = $this->getMockBuilder(UriBuilder::class)->disableOriginalConstructor()->getMock(); + $uriBuilder->expects(self::once())->method('reset')->willReturn($uriBuilder); + $uriBuilder->expects(self::once())->method('setRequest')->with($this->extbaseRequest)->willReturn($uriBuilder); + $uriBuilder->expects(self::once())->method('setCreateAbsoluteUri')->with(true)->willReturn($uriBuilder); + $uriBuilder->expects(self::once())->method('uriFor')->with( + 'showChangePassword', + ['hash' => $recoveryConfiguration['forgotHash']], + 'PasswordRecovery', + 'felogin', + 'Login' + )->willReturn('some uri'); + + $fluidEmailMock = $this->setupFluidEmailMock($receiver, $expectedViewVariables, $recoveryConfiguration); + + $mailer = $this->getMockBuilder(MailerInterface::class)->disableOriginalConstructor()->getMock(); + $mailer->expects(self::once())->method('send')->with($fluidEmailMock); + + $eventDispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)->getMock(); + $subject = $this->getMockBuilder(RecoveryService::class) + ->onlyMethods(['getEmailSubject']) + ->setConstructorArgs( + [ + $mailer, + $eventDispatcherMock, + $configurationManager, + $this->recoveryConfiguration, + $uriBuilder, + $this->userRepository, + ] + )->getMock(); + $subject->method('getEmailSubject')->willReturn('translation'); + + $subject->sendRecoveryEmail($this->extbaseRequest, $userInformation, $recoveryConfiguration['forgotHash']); + } + + private function mockRecoveryConfigurationAndUserRepository( int $uid, array $recoveryConfiguration, array $userInformation diff --git a/typo3/sysext/frontend/Tests/Functional/Rendering/LocalizedSiteContentRenderingTest.php b/typo3/sysext/frontend/Tests/Functional/Rendering/LocalizedSiteContentRenderingTest.php index 9ba32f623dd7..9d6fd9d11535 100644 --- a/typo3/sysext/frontend/Tests/Functional/Rendering/LocalizedSiteContentRenderingTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Rendering/LocalizedSiteContentRenderingTest.php @@ -289,7 +289,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT */ #[DataProvider('dutchDataProvider')] #[Test] - public function renderingOfDutchLanguage(array $languageConfiguration, array $visibleRecords, string $fallbackType, string $fallbackChain, string $overlayType): void + public function renderingOfDutchLanguage(array $languageConfiguration, array $visibleRecords, string $fallbackType, string $fallbackChain, string $overlayMode): void { $this->writeSiteConfiguration( 'test', @@ -342,7 +342,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT self::assertEquals(1, $responseStructure->getScopePath('languageInfo/contentId'), 'contentId does not match'); self::assertEquals($fallbackType, $responseStructure->getScopePath('languageInfo/fallbackType'), 'fallbackType does not match'); self::assertEquals($fallbackChain, $responseStructure->getScopePath('languageInfo/fallbackChain'), 'fallbackChain does not match'); - self::assertEquals($overlayType, $responseStructure->getScopePath('languageInfo/overlayType'), 'language overlayType does not match'); + self::assertEquals($overlayMode, $responseStructure->getScopePath('languageInfo/overlayType'), 'language overlayType does not match'); } public static function contentOnNonTranslatedPageDataProvider(): array @@ -374,7 +374,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => 'Default language Page', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'free', 'fallbackChain' => '0,pageNotFound', 'overlayMode' => 'off', @@ -400,7 +400,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => 'Default language Page', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'free', 'fallbackChain' => '0,pageNotFound', 'overlayMode' => 'off', @@ -430,7 +430,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => '[DA]Page', 'languageId' => 2, - 'contentId' => 1, + 'contentLanguageId' => 1, 'fallbackType' => 'free', 'fallbackChain' => '1,0,pageNotFound', 'overlayMode' => 'off', @@ -442,7 +442,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT 'visibleRecords' => [], 'pageTitle' => '', 'languageId' => 2, - 'contentId' => 2, + 'contentLanguageId' => 2, 'fallbackType' => 'free', 'fallbackChain' => 'pageNotFound', 'overlayMode' => 'off', @@ -469,7 +469,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => 'Default language Page', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'fallback', 'fallbackChain' => '0,pageNotFound', 'overlayMode' => 'mixed', @@ -496,7 +496,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => 'Default language Page', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'fallback', 'fallbackChain' => '0,pageNotFound', 'overlayMode' => 'mixed', @@ -524,7 +524,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => '[DA]Page', 'languageId' => 2, - 'contentId' => 1, + 'contentLanguageId' => 1, 'fallbackType' => 'fallback', 'fallbackChain' => '1,0,pageNotFound', 'overlayMode' => 'mixed', @@ -537,7 +537,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT 'visibleRecords' => [], 'pageTitle' => '', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'fallback', 'fallbackChain' => 'pageNotFound', 'overlayMode' => 'mixed', @@ -564,7 +564,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => 'Default language Page', 'languageId' => 2, - 'contentId' => 0, + 'contentLanguageId' => 0, 'fallbackType' => 'strict', 'fallbackChain' => '0,pageNotFound', 'overlayMode' => 'includeFloating', @@ -590,7 +590,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT ], 'pageTitle' => '[DA]Page', 'languageId' => 2, - 'contentId' => 1, + 'contentLanguageId' => 1, 'fallbackType' => 'strict', 'fallbackChain' => '1,0,pageNotFound', 'overlayMode' => 'includeFloating', @@ -603,7 +603,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT 'visibleRecords' => [], 'pageTitle' => '', 'languageId' => 2, - 'contentId' => 1, + 'contentLanguageId' => 1, 'fallbackType' => 'strict', 'fallbackChain' => 'pageNotFound', 'overlayMode' => 'includeFloating', @@ -786,7 +786,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT */ #[DataProvider('contentOnPartiallyTranslatedPageDataProvider')] #[Test] - public function contentOnPartiallyTranslatedPage(array $languageConfiguration, array $visibleHeaders, string $fallbackType, string $fallbackChain, string $overlayType): void + public function contentOnPartiallyTranslatedPage(array $languageConfiguration, array $visibleRecordHeaders, string $fallbackType, string $fallbackChain, string $overlayMode): void { $this->writeSiteConfiguration( 'test', @@ -812,14 +812,14 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT $this->getRequestSectionHasRecordConstraint() ->setTable(self::TABLE_Content) ->setField('header') - ->setValues(...$visibleHeaders) + ->setValues(...$visibleRecordHeaders) ); self::assertThat( $responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint() ->setTable(self::TABLE_Content) ->setField('header') - ->setValues(...$this->getNonVisibleHeaders($visibleHeaders)) + ->setValues(...$this->getNonVisibleHeaders($visibleRecordHeaders)) ); self::assertEquals('[PL]Page', $responseStructure->getScopePath('page/title')); @@ -827,7 +827,7 @@ final class LocalizedSiteContentRenderingTest extends AbstractDataHandlerActionT self::assertEquals(3, $responseStructure->getScopePath('languageInfo/contentId'), 'contentId does not match'); self::assertEquals($fallbackType, $responseStructure->getScopePath('languageInfo/fallbackType'), 'fallbackType does not match'); self::assertEquals($fallbackChain, $responseStructure->getScopePath('languageInfo/fallbackChain'), 'fallbackChain does not match'); - self::assertEquals($overlayType, $responseStructure->getScopePath('languageInfo/overlayType'), 'language overlayType does not match'); + self::assertEquals($overlayMode, $responseStructure->getScopePath('languageInfo/overlayType'), 'language overlayType does not match'); } /** diff --git a/typo3/sysext/frontend/Tests/Functional/Request/InternalRequestDataMappingTest.php b/typo3/sysext/frontend/Tests/Functional/Request/InternalRequestDataMappingTest.php index 2b3d912adf3d..3381fc215b9d 100644 --- a/typo3/sysext/frontend/Tests/Functional/Request/InternalRequestDataMappingTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Request/InternalRequestDataMappingTest.php @@ -229,7 +229,7 @@ final class InternalRequestDataMappingTest extends FunctionalTestCase 'method' => 'GET', 'queryParams' => [], 'parsedBody' => null, - [], + 'headers' => [], 'body' => null, 'expectedJsonKeyValues' => [ 'method' => 'GET', @@ -248,7 +248,7 @@ final class InternalRequestDataMappingTest extends FunctionalTestCase 'method' => 'GET', 'queryParams' => ['queryParam1' => 'value1'], 'parsedBody' => null, - [], + 'headers' => [], 'body' => null, 'expectedJsonKeyValues' => [ 'method' => 'GET', @@ -267,7 +267,7 @@ final class InternalRequestDataMappingTest extends FunctionalTestCase 'method' => 'GET', 'queryParams' => ['queryParam1' => 'value1'], 'parsedBody' => null, - [], + 'headers' => [], 'body' => null, 'expectedJsonKeyValues' => [ 'method' => 'GET', diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioATest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioATest.php index 4f5b33a9aebf..da1927285fce 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioATest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioATest.php @@ -96,19 +96,19 @@ final class ScenarioATest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/en/hello', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ], ], [ 'url' => 'https://acme.com/de/willkommen', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'], ], ], [ 'url' => 'https://acme.com/de-ch/willkommen', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Willkommen', 'link' => '/de-ch/willkommen'], ], ], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioBTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioBTest.php index d40a739a3cb2..02227208c779 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioBTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioBTest.php @@ -117,14 +117,14 @@ final class ScenarioBTest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/en/hello', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ['title' => 'EN: About us', 'link' => '/en/about-us'], ], ], [ 'url' => 'https://acme.com/de-ch/hello', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/de-ch/hello'], ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/about-us'], ], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioCTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioCTest.php index d68301443f74..fd1351dbc4ec 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioCTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioCTest.php @@ -121,27 +121,27 @@ final class ScenarioCTest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/en/hello', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ['title' => 'EN: About us', 'link' => '/en/about-us'], ], ], [ 'url' => 'https://acme.com/de/willkommen', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'], ], ], [ 'url' => 'https://acme.com/en/about-us', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ['title' => 'EN: About us', 'link' => '/en/about-us'], ], ], [ 'url' => 'https://acme.com/de-ch/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'], ], ], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioDTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioDTest.php index 26a1810d5b9d..52cd09ab0667 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioDTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioDTest.php @@ -129,7 +129,7 @@ final class ScenarioDTest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/en/hello', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ['title' => 'EN: About us', 'link' => '/en/about-us'], ['title' => 'EN: Products', 'link' => '/en/products'], @@ -139,7 +139,7 @@ final class ScenarioDTest extends AbstractLocalizedPagesTestCase ], [ 'url' => 'https://acme.com/en/about-us', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'EN: Welcome', 'link' => '/en/hello'], ['title' => 'EN: About us', 'link' => '/en/about-us'], ['title' => 'EN: Products', 'link' => '/en/products'], @@ -149,14 +149,14 @@ final class ScenarioDTest extends AbstractLocalizedPagesTestCase ], [ 'url' => 'https://acme.com/de/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'], ['title' => 'DE: Unternehmen', 'link' => '/de/ueber-uns'], ], ], [ 'url' => 'https://acme.com/de-ch/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'], ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'], ['title' => 'EN: Shortcut to welcome', 'link' => ''], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioETest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioETest.php index ff9bb12819cd..40e02a180a06 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioETest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioETest.php @@ -127,14 +127,14 @@ final class ScenarioETest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/de/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'], ['title' => 'DE: Produkte', 'link' => '/de/produkte'], ], ], [ 'url' => 'https://acme.com/de-ch/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Über uns', 'link' => '/de-ch/ueber-uns'], ['title' => 'DE: Produkte', 'link' => '/de-ch/produkte'], ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/hello'], @@ -142,7 +142,7 @@ final class ScenarioETest extends AbstractLocalizedPagesTestCase ], [ 'url' => 'https://acme.com/de-ch/about-us', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Über uns', 'link' => '/de-ch/ueber-uns'], ['title' => 'DE: Produkte', 'link' => '/de-ch/produkte'], ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/hello'], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioFTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioFTest.php index a95be7619409..bbf1b6f9a670 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioFTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioFTest.php @@ -132,7 +132,7 @@ final class ScenarioFTest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/de/ueber-uns', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'], ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'], ['title' => 'DE: Produkte', 'link' => '/de/produkte'], @@ -140,7 +140,7 @@ final class ScenarioFTest extends AbstractLocalizedPagesTestCase ], [ 'url' => 'https://acme.com/de/produkte', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'], ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'], ['title' => 'DE: Produkte', 'link' => '/de/produkte'], @@ -148,7 +148,7 @@ final class ScenarioFTest extends AbstractLocalizedPagesTestCase ], [ 'url' => 'https://acme.com/de-ch/produkte', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'], // FIXME: Page "EN: Shortcut to welcome" must to be rendered in menu, needs a refactored menu generation ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/willkommen'], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioGTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioGTest.php index c860b33f8308..6e390b6f61c0 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioGTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/ScenarioGTest.php @@ -61,7 +61,7 @@ final class ScenarioGTest extends AbstractLocalizedPagesTestCase return [ [ 'url' => 'https://acme.com/de-ch/willkommen', - 'menu' => [ + 'expectedMenu' => [ ['title' => 'DE-CH: Willkommen', 'link' => '/de-ch/willkommen'], ['title' => 'DE: Über uns', 'link' => '/de-ch/ueber-uns'], ['title' => 'DE: Abkürzung zu Über uns', 'link' => '/de-ch/ueber-uns'], diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php index b68c634402f5..3e15d07038a7 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php @@ -858,35 +858,35 @@ final class SlugLinkGeneratorTest extends AbstractTestCase public static function hierarchicalMenuAlwaysResolvesToDefaultLanguageDataProvider(): array { return [ - 'no banned IDs in default language' => [ - 'language' => 0, - 'banned IDs' => '', - 'expected menu items' => 13, + 'no banned IDs in default languageId' => [ + 'languageId' => 0, + 'excludedUidList' => '', + 'expectedMenuItems' => 13, ], 'no banned IDs in FR' => [ - 'language' => 1, - 'banned IDs' => '', - 'expected menu items' => 13, + 'languageId' => 1, + 'excludedUidList' => '', + 'expectedMenuItems' => 13, ], - 'banned IDs in default language' => [ - 'language' => 0, - 'banned IDs' => '1100,1200,1300,1400,403,404', - 'expected menu items' => 7, + 'banned IDs in default languageId' => [ + 'languageId' => 0, + 'excludedUidList' => '1100,1200,1300,1400,403,404', + 'expectedMenuItems' => 7, ], - 'banned IDs in FR language' => [ - 'language' => 1, - 'banned IDs' => '1100,1200,1300,1400,403,404', - 'expected menu items' => 7, + 'banned IDs in FR languageId' => [ + 'languageId' => 1, + 'excludedUidList' => '1100,1200,1300,1400,403,404', + 'expectedMenuItems' => 7, ], - 'banned translated IDs in default language' => [ - 'language' => 0, - 'banned IDs' => '1101,1200,1300,1400,403,404', - 'expected menu items' => 8, + 'banned translated IDs in default languageId' => [ + 'languageId' => 0, + 'excludedUidList' => '1101,1200,1300,1400,403,404', + 'expectedMenuItems' => 8, ], - 'banned translated IDs in FR language' => [ - 'language' => 1, - 'banned IDs' => '1101,1200,1300,1400,403,404', - 'expected menu items' => 7, + 'banned translated IDs in FR languageId' => [ + 'languageId' => 1, + 'excludedUidList' => '1101,1200,1300,1400,403,404', + 'expectedMenuItems' => 7, ], ]; } diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php index c27bd28a4b90..4c32f0cd635a 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php @@ -1226,35 +1226,35 @@ final class SlugSiteRequestTest extends AbstractTestCase { yield 'Live page with logged-in user' => [ 'url' => 'https://website.local/en-en/welcome', - 'pageTitle' => 'EN: Welcome', - 'Online Page ID' => 1100, - 'Workspace ID' => 0, - 'Backend User ID' => 1, - 'statusCode' => 200, + 'expectedPageTitle' => 'EN: Welcome', + 'expectedPageId' => 1100, + 'workspaceId' => 0, + 'backendUserId' => 1, + 'expectedStatusCode' => 200, ]; yield 'Live page with logged-in user accessed even though versioned page slug was changed' => [ 'url' => 'https://website.local/en-en/welcome', - 'pageTitle' => 'EN: Welcome to ACME Inc', - 'Online Page ID' => 1100, - 'Workspace ID' => 1, - 'Backend User ID' => 1, - 'statusCode' => 200, + 'expectedPageTitle' => 'EN: Welcome to ACME Inc', + 'expectedPageId' => 1100, + 'workspaceId' => 1, + 'backendUserId' => 1, + 'expectedStatusCode' => 200, ]; yield 'Versioned page with logged-in user and modified slug' => [ 'url' => 'https://website.local/en-en/welcome-modified', - 'pageTitle' => 'EN: Welcome to ACME Inc', - 'Online Page ID' => 1100, - 'Workspace ID' => 1, - 'Backend User ID' => 1, - 'statusCode' => 200, + 'expectedPageTitle' => 'EN: Welcome to ACME Inc', + 'expectedPageId' => 1100, + 'workspaceId' => 1, + 'backendUserId' => 1, + 'expectedStatusCode' => 200, ]; yield 'Versioned page without logged-in user renders 404' => [ 'url' => 'https://website.local/en-en/welcome-modified', - 'pageTitle' => null, - 'Online Page ID' => null, - 'Workspace ID' => 1, - 'Backend User ID' => 0, - 'statusCode' => 404, + 'expectedPageTitle' => null, + 'expectedPageId' => null, + 'workspaceId' => 1, + 'backendUserId' => 0, + 'expectedStatusCode' => 404, ]; } diff --git a/typo3/sysext/install/Tests/Functional/UpgradeAnalysis/DocumentationFileTest.php b/typo3/sysext/install/Tests/Functional/UpgradeAnalysis/DocumentationFileTest.php index 7d2ff4d2cb55..823610a0c4ab 100644 --- a/typo3/sysext/install/Tests/Functional/UpgradeAnalysis/DocumentationFileTest.php +++ b/typo3/sysext/install/Tests/Functional/UpgradeAnalysis/DocumentationFileTest.php @@ -87,9 +87,9 @@ final class DocumentationFileTest extends FunctionalTestCase public static function invalidDirProvider(): array { return [ - ['root' => '/'], - ['etc' => '/etc'], - ['etc/passwd' => '/etc/passwd'], + 'root' => ['/'], + 'etc' => ['/etc'], + 'etc/passwd' => ['/etc/passwd'], ]; } @@ -109,8 +109,8 @@ final class DocumentationFileTest extends FunctionalTestCase public static function invalidFilesProvider(): array { return [ - ['/etc/passwd' => '/etc/passwd'], - ['root' => '/'], + '/etc/passwd' => ['/etc/passwd'], + 'root' => ['/'], ]; } diff --git a/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php b/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php index dc949df9c8af..c8efdddc39ce 100644 --- a/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php +++ b/typo3/sysext/install/Tests/Functional/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php @@ -52,7 +52,7 @@ final class PhpErrorCodeViewHelperTest extends FunctionalTestCase #[DataProvider('errorCodesDataProvider')] #[Test] - public function renderPhpCodesCorrectly(int $errorCode, string $expected): void + public function renderPhpCodesCorrectly(int $errorCode, string $expectedString): void { // Happy little hack for VH tests in install tool: ViewHelperResolver // createViewHelperInstanceFromClassName() has an early check for @@ -66,6 +66,6 @@ final class PhpErrorCodeViewHelperTest extends FunctionalTestCase $context = $this->get(RenderingContextFactory::class)->create(); $context->getViewHelperResolver()->addNamespace('install', 'TYPO3\\CMS\\Install\\ViewHelpers'); $context->getTemplatePaths()->setTemplateSource('<install:format.phpErrorCode phpErrorCode="' . $errorCode . '" />'); - self::assertSame($expected, (new TemplateView($context))->render()); + self::assertSame($expectedString, (new TemplateView($context))->render()); } } diff --git a/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php b/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php index 72bcd42360cc..0e29d3412a72 100644 --- a/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php +++ b/typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php @@ -920,7 +920,7 @@ final class RedirectServiceTest extends FunctionalTestCase { // Regression test for https://forge.typo3.org/issues/101191 yield '#1 Non-query argument regex redirect not respecting get arguments before query-argument regex does not match before query-argument regex' => [ - 'dataSet' => __DIR__ . '/Fixtures/RegExp/case1.csv', + 'importDataSet' => __DIR__ . '/Fixtures/RegExp/case1.csv', 'url' => 'https://acme.com/foo/lightbar.html?type=101', 'statusCode' => 301, 'redirectUid' => 2, @@ -928,7 +928,7 @@ final class RedirectServiceTest extends FunctionalTestCase ]; yield '#2 Non-query argument regex redirect respecting get arguments before query-argument regex does not match before query-argument regex' => [ - 'dataSet' => __DIR__ . '/Fixtures/RegExp/case2.csv', + 'importDataSet' => __DIR__ . '/Fixtures/RegExp/case2.csv', 'url' => 'https://acme.com/foo/lightbar.html?type=101', 'statusCode' => 301, 'redirectUid' => 2, @@ -940,7 +940,7 @@ final class RedirectServiceTest extends FunctionalTestCase // this case. For example missing trailing `$` or leaving the `respect_query_parameters` option unchecked would // mitigate this. yield '#3 To open non-query argument regex redirect respecting get arguments before query-argument regex proceeds query-argument regex' => [ - 'dataSet' => __DIR__ . '/Fixtures/RegExp/case3.csv', + 'importDataSet' => __DIR__ . '/Fixtures/RegExp/case3.csv', 'url' => 'https://acme.com/foo/lightbar.html?type=101', 'statusCode' => 301, 'redirectUid' => 1, -- GitLab