From 031cbb66f06a7fed00ca36888bb17716ea3d5f63 Mon Sep 17 00:00:00 2001 From: Nikita Hovratov <nikita.h@live.de> Date: Sat, 4 Feb 2023 04:40:17 +0100 Subject: [PATCH] [TASK] Migrate deprecated PHPUnit 9 methods Since the recent release of PHPUnit 9.6 some new deprecations were added which signal breaking changes for version 10. As deprecations are causing our tests to fail, they need to be addressed immediately. Method `expectErrorMessage` replaced with `expectExceptionMessage`. Method `getMockClass` replaced with `createMock` and a subsequent get_class call. Move test with deprecations to UnitDeprecated and remove expectation. Also update phpunit/phpunit and dependencies to latest version: > composer req --dev phpunit/phpunit:^9.6.1 -W Resolves: #99817 Releases: main, 11.5 Change-Id: I6d01ccca398a8ff5db735a35b19061b711c843cc Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77693 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- composer.json | 2 +- composer.lock | 138 +++++++++--------- .../Tests/Unit/Cache/CacheManagerTest.php | 40 ----- .../Unit/Console/CommandRegistryTest.php | 12 +- .../Unit/DataHandling/DataHandlerTest.php | 2 +- .../Parser/DataTypes/DateTimeTypesTest.php | 4 +- .../Unit/Routing/Aspect/AspectFactoryTest.php | 8 +- .../UnitDeprecated/Cache/CacheManagerTest.php | 65 +++++++++ .../PropertyMappingConfigurationTest.php | 11 +- .../ViewHelpers/Format/HtmlViewHelperTest.php | 37 ----- .../ViewHelpers/Format/HtmlViewHelperTest.php | 3 - 11 files changed, 155 insertions(+), 167 deletions(-) create mode 100644 typo3/sysext/core/Tests/UnitDeprecated/Cache/CacheManagerTest.php diff --git a/composer.json b/composer.json index e706250e5bfc..14acb44278cd 100644 --- a/composer.json +++ b/composer.json @@ -121,7 +121,7 @@ "phpspec/prophecy-phpunit": "^2.0.1", "phpstan/phpstan": "^1.9.12", "phpstan/phpstan-phpunit": "^1.3.3", - "phpunit/phpunit": "^9.5.21", + "phpunit/phpunit": "^9.6.1", "typo3/cms-styleguide": "~11.5.4", "typo3/testing-framework": "^6.16.6", "webmozart/assert": "^1.11.0" diff --git a/composer.lock b/composer.lock index 24e01bfd4bce..2caec76d1b6f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e0635b609153bf758fdaf934a97b4694", + "content-hash": "7ed35df0229ccc6cce814cd13a676075", "packages": [ { "name": "bacon/bacon-qr-code", @@ -564,30 +564,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -614,7 +614,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -630,7 +630,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "doctrine/lexer", @@ -1288,16 +1288,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -1338,9 +1338,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -7262,23 +7262,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -7327,7 +7327,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -7335,7 +7335,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", @@ -7580,20 +7580,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.21", + "version": "9.6.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "reference": "9a52e8385f3e432d7e8ecab72c4d211a67223285" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9a52e8385f3e432d7e8ecab72c4d211a67223285", + "reference": "9a52e8385f3e432d7e8ecab72c4d211a67223285", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -7604,7 +7604,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -7612,19 +7611,16 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -7635,7 +7631,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -7666,7 +7662,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.1" }, "funding": [ { @@ -7676,9 +7672,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2023-02-03T19:31:30+00:00" }, { "name": "react/promise", @@ -7925,16 +7925,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -7987,7 +7987,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -7995,7 +7995,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -8122,16 +8122,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -8173,7 +8173,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -8181,20 +8181,20 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -8250,7 +8250,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -8258,7 +8258,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -8495,16 +8495,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -8543,10 +8543,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -8554,7 +8554,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -8613,16 +8613,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -8634,7 +8634,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -8657,7 +8657,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -8665,7 +8665,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", diff --git a/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php b/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php index 6d99d3629f14..1a4177b17eac 100644 --- a/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php +++ b/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php @@ -500,46 +500,6 @@ class CacheManagerTest extends UnitTestCase $manager->flushCachesInGroupByTags('group2', $tags); } - /** - * @test - */ - public function setCacheConfigurationsMergesLegacyConfigCorrectly(): void - { - $rawConfiguration = [ - 'pages' => [ - 'frontend' => VariableFrontend::class, - 'backend' => Typo3DatabaseBackend::class, - 'options' => [ - 'compression' => true, - ], - 'groups' => ['pages'], - ], - 'cache_pages' => [ - 'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class, - 'options' => [ - 'hostname' => 'redis', - ], - 'groups' => ['pages'], - ], - ]; - $expectedConfiguration = [ - 'pages' => [ - 'frontend' => VariableFrontend::class, - 'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class, - 'options' => [ - 'compression' => true, - 'hostname' => 'redis', - ], - 'groups' => ['pages'], - ], - ]; - $this->expectDeprecation(); - - $manager = $this->getAccessibleMock(CacheManager::class, ['dummy']); - $manager->setCacheConfigurations($rawConfiguration); - self::assertEquals($expectedConfiguration, $manager->_get('cacheConfigurations')); - } - /** * @test */ diff --git a/typo3/sysext/core/Tests/Unit/Console/CommandRegistryTest.php b/typo3/sysext/core/Tests/Unit/Console/CommandRegistryTest.php index f96b297ea3cf..1d4d4aa995d2 100644 --- a/typo3/sysext/core/Tests/Unit/Console/CommandRegistryTest.php +++ b/typo3/sysext/core/Tests/Unit/Console/CommandRegistryTest.php @@ -59,11 +59,13 @@ class CommandRegistryTest extends UnitTestCase */ public function iteratesLazyCommandsOfActivePackages(): void { - $command1MockClass = $this->getMockClass(Command::class, ['dummy']); - $command2MockClass = $this->getMockClass(Command::class, ['dummy']); + $command1Mock = $this->createMock(Command::class); + $command2Mock = $this->createMock(Command::class); + $command1MockClass = get_class($command1Mock); + $command2MockClass = get_class($command2Mock); - $this->containerProphecy->get('command1')->willReturn(new $command1MockClass()); - $this->containerProphecy->get('command2')->willReturn(new $command2MockClass()); + $this->containerProphecy->get('command1')->willReturn($command1Mock); + $this->containerProphecy->get('command2')->willReturn($command2Mock); $commandRegistry = new CommandRegistry($this->containerProphecy->reveal()); $commandRegistry->addLazyCommand('test:command', 'command1'); @@ -73,6 +75,6 @@ class CommandRegistryTest extends UnitTestCase self::assertCount(2, $commandNames); self::assertInstanceOf($command1MockClass, $commandRegistry->get('test:command')); - self::assertInstanceOf($command1MockClass, $commandRegistry->get('test:command2')); + self::assertInstanceOf($command2MockClass, $commandRegistry->get('test:command2')); } } diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php index de52b97afbab..712c1fb6001c 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php @@ -1358,7 +1358,7 @@ class DataHandlerTest extends UnitTestCase $values = [1, 2, 3, 4, 5]; $this->expectException(\RuntimeException::class); $this->expectExceptionCode(1336051942); - $this->expectDeprecationMessage('Expected userFunc filter "TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\UserOddNumberFilter->filter" to return an array. Got NULL.'); + $this->expectExceptionMessage('Expected userFunc filter "TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\UserOddNumberFilter->filter" to return an array. Got NULL.'); $this->subject->_call('applyFiltersToValues', $tcaFieldConfiguration, $values); } } diff --git a/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/DataTypes/DateTimeTypesTest.php b/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/DataTypes/DateTimeTypesTest.php index 9eec2d2ad17b..55160ed05ea6 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/DataTypes/DateTimeTypesTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/DataTypes/DateTimeTypesTest.php @@ -106,7 +106,7 @@ class DateTimeTypesTest extends AbstractDataTypeBaseTestCase public function parseDateTimeTypeWithInvalidLowerBound(): void { $this->expectException(StatementException::class); - $this->expectDeprecationMessageMatches( + $this->expectExceptionMessageMatches( '@Error: the fractional seconds part for TIME, DATETIME or TIMESTAMP columns must >= 0@' ); $this->createSubject('TIME(-1)'); @@ -118,7 +118,7 @@ class DateTimeTypesTest extends AbstractDataTypeBaseTestCase public function parseDateTimeTypeWithInvalidUpperBound(): void { $this->expectException(StatementException::class); - $this->expectDeprecationMessageMatches( + $this->expectExceptionMessageMatches( '@Error: the fractional seconds part for TIME, DATETIME or TIMESTAMP columns must <= 6@' ); $this->createSubject('TIME(7)'); diff --git a/typo3/sysext/core/Tests/Unit/Routing/Aspect/AspectFactoryTest.php b/typo3/sysext/core/Tests/Unit/Routing/Aspect/AspectFactoryTest.php index 786a4c3317cc..fca6d51070a7 100644 --- a/typo3/sysext/core/Tests/Unit/Routing/Aspect/AspectFactoryTest.php +++ b/typo3/sysext/core/Tests/Unit/Routing/Aspect/AspectFactoryTest.php @@ -51,12 +51,12 @@ class AspectFactoryTest extends UnitTestCase $this->siteProphecy = $this->prophesize( Site::class ); - $this->persistedMockClass = $this->getMockClass( + $this->persistedMockClass = get_class($this->createMock( PersistedMappableAspectInterface::class - ); - $this->aspectMockClass = $this->getMockClass( + )); + $this->aspectMockClass = get_class($this->createMock( AspectInterface::class - ); + )); $GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects'] = [ 'Persisted' => $this->persistedMockClass, 'Aspect' => $this->aspectMockClass, diff --git a/typo3/sysext/core/Tests/UnitDeprecated/Cache/CacheManagerTest.php b/typo3/sysext/core/Tests/UnitDeprecated/Cache/CacheManagerTest.php new file mode 100644 index 000000000000..c283c3bdb4dc --- /dev/null +++ b/typo3/sysext/core/Tests/UnitDeprecated/Cache/CacheManagerTest.php @@ -0,0 +1,65 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Cache; + +use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend; +use TYPO3\CMS\Core\Cache\CacheManager; +use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase; + +class CacheManagerTest extends UnitTestCase +{ + /** + * @test + */ + public function setCacheConfigurationsMergesLegacyConfigCorrectly(): void + { + $rawConfiguration = [ + 'pages' => [ + 'frontend' => VariableFrontend::class, + 'backend' => Typo3DatabaseBackend::class, + 'options' => [ + 'compression' => true, + ], + 'groups' => ['pages'], + ], + 'cache_pages' => [ + 'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class, + 'options' => [ + 'hostname' => 'redis', + ], + 'groups' => ['pages'], + ], + ]; + $expectedConfiguration = [ + 'pages' => [ + 'frontend' => VariableFrontend::class, + 'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class, + 'options' => [ + 'compression' => true, + 'hostname' => 'redis', + ], + 'groups' => ['pages'], + ], + ]; + + $manager = $this->getAccessibleMock(CacheManager::class, ['dummy']); + $manager->setCacheConfigurations($rawConfiguration); + self::assertEquals($expectedConfiguration, $manager->_get('cacheConfigurations')); + } +} diff --git a/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php b/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php index 55b91661977f..09450ba593b5 100644 --- a/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php @@ -118,7 +118,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase */ public function setTypeConverterOptionsCanBeRetrievedAgain(): void { - $mockTypeConverterClass = $this->getMockClass(TypeConverterInterface::class); + $mockTypeConverterClass = get_class($this->createMock(TypeConverterInterface::class)); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, ['k1' => 'v1', 'k2' => 'v2']); self::assertEquals('v1', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass, 'k1')); @@ -138,7 +138,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase */ public function setTypeConverterOptionsShouldOverrideAlreadySetOptions(): void { - $mockTypeConverterClass = $this->getMockClass(TypeConverterInterface::class); + $mockTypeConverterClass = get_class($this->createMock(TypeConverterInterface::class)); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, ['k1' => 'v1', 'k2' => 'v2']); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, ['k3' => 'v3']); @@ -151,7 +151,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase */ public function setTypeConverterOptionShouldOverrideAlreadySetOptions(): void { - $mockTypeConverterClass = $this->getMockClass(TypeConverterInterface::class); + $mockTypeConverterClass = get_class($this->createMock(TypeConverterInterface::class)); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, ['k1' => 'v1', 'k2' => 'v2']); $this->propertyMappingConfiguration->setTypeConverterOption($mockTypeConverterClass, 'k1', 'v3'); @@ -203,7 +203,8 @@ class PropertyMappingConfigurationTest extends UnitTestCase */ public function fluentInterfaceMethodsDataProvider(): array { - $mockTypeConverterClass = $this->getMockClass(TypeConverterInterface::class); + $mockTypeConverter = $this->createMock(TypeConverterInterface::class); + $mockTypeConverterClass = get_class($mockTypeConverter); return [ ['allowAllProperties'], @@ -212,7 +213,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase ['setMapping', ['k1', 'k1a']], ['setTypeConverterOptions', [$mockTypeConverterClass, ['k1' => 'v1', 'k2' => 'v2']]], ['setTypeConverterOption', [$mockTypeConverterClass, 'k1', 'v3']], - ['setTypeConverter', [$this->createMock(TypeConverterInterface::class)]], + ['setTypeConverter', [$mockTypeConverter]], ]; } diff --git a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Format/HtmlViewHelperTest.php b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Format/HtmlViewHelperTest.php index 19a163ffb90d..fa40517bdacf 100644 --- a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Format/HtmlViewHelperTest.php +++ b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Format/HtmlViewHelperTest.php @@ -75,43 +75,6 @@ class HtmlViewHelperTest extends FunctionalTestCase self::assertStringContainsString($expected, (string)$response->getBody()); } - public function invalidInvocationIsDeterminedDataProvider(): array - { - return [ - 'explicitly empty parseFunc path' => [ - '<f:format.html parseFuncTSPath="">TYPO3 is a cool CMS</f:format.html>', - ], - 'non-existing parseFunc path' => [ - '<f:format.html parseFuncTSPath="null.this.does.not.exist">TYPO3 is a cool CMS</f:format.html>', - ], - ]; - } - - /** - * @test - * @dataProvider invalidInvocationIsDeterminedDataProvider - * @see \TYPO3\CMS\Fluid\Tests\FunctionalDeprecated\ViewHelpers\Format\HtmlViewHelperTest::contentIsRendered for - * the counterpart which tests that the deprecated functionality still works. - */ - public function invalidInvocationIsDetermined(string $fluidTemplateSource): void - { - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/pages.csv'); - $this->writeSiteConfiguration( - 'test', - $this->buildSiteConfiguration(1, '/'), - [ - $this->buildDefaultLanguageConfiguration('EN', '/en/'), - ] - ); - $this->createTypoScriptTemplate($fluidTemplateSource); - - $this->expectDeprecation(); - $this->expectExceptionMessage('Invoking ContentObjectRenderer::parseFunc without any configuration will trigger an exception in TYPO3 v12.0'); - $this->executeFrontendSubRequest( - (new InternalRequest())->withPageId(1) - ); - } - private function createTypoScriptTemplate(string $fluidTemplateSource): void { (new ConnectionPool())->getConnectionForTable('sys_template') diff --git a/typo3/sysext/fluid/Tests/FunctionalDeprecated/ViewHelpers/Format/HtmlViewHelperTest.php b/typo3/sysext/fluid/Tests/FunctionalDeprecated/ViewHelpers/Format/HtmlViewHelperTest.php index 97ec11af24ec..ed59eaf945b9 100644 --- a/typo3/sysext/fluid/Tests/FunctionalDeprecated/ViewHelpers/Format/HtmlViewHelperTest.php +++ b/typo3/sysext/fluid/Tests/FunctionalDeprecated/ViewHelpers/Format/HtmlViewHelperTest.php @@ -50,9 +50,6 @@ class HtmlViewHelperTest extends FunctionalTestCase /** * @test * @dataProvider contentIsRenderedDataProvider - * @see \TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\HtmlViewHelperTest::invalidInvocationIsDetermined for - * the counterpart which tests for the deprecation directly. Here we test that deprecated functionality still - * works. */ public function contentIsRendered(string $fluidTemplateSource, string $expected): void { -- GitLab