From 879d1b495d497c078d327d408d1574f2dbace3cf Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 10 Sep 2023 14:25:40 +0200 Subject: [PATCH] [TASK] Stop using getAccessibleMockForAbstractClass in EXT:core `getMockForAbstractClass` has been (soft-)deprecated in PHPUnit 10.1: https://github.com/sebastianbergmann/phpunit/issues/5241 Hence, we should replace its usages to follow best practices and avoid deprecation warnings later with PHPUnit 11. We do this by creating dedicated fixture subclasses of the affected abstract classes. Resolves: #101892 Related: #101601 Releases: main, 12.4 Change-Id: Id1977130c5e2a9bdc54fb92aea7dfc63ecf55724 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80940 Tested-by: Benjamin Franzke Reviewed-by: Benjamin Franzke Tested-by: Benni Mack Reviewed-by: Benni Mack Tested-by: core-ci --- ...stractHierarchicalFilesystemDriverTest.php | 10 +- .../TestingHierarchicalFilesystemDriver.php | 275 ++++++++++++++++++ 2 files changed, 280 insertions(+), 5 deletions(-) create mode 100644 typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/TestingHierarchicalFilesystemDriver.php diff --git a/typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractHierarchicalFilesystemDriverTest.php b/typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractHierarchicalFilesystemDriverTest.php index d8ebf3316d70..9efb766bedbc 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractHierarchicalFilesystemDriverTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractHierarchicalFilesystemDriverTest.php @@ -17,7 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Driver; -use TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver; +use TYPO3\CMS\Core\Tests\Unit\Resource\Driver\Fixtures\TestingHierarchicalFilesystemDriver; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; final class AbstractHierarchicalFilesystemDriverTest extends UnitTestCase @@ -66,8 +66,8 @@ public static function canonicalizeAndCheckFileIdentifierCanonicalizesPathDataPr */ public function canonicalizeAndCheckFileIdentifierCanonicalizesPath(string $expectedPath, string $fileIdentifier): void { - $subject = $this->getAccessibleMockForAbstractClass(AbstractHierarchicalFilesystemDriver::class, [], '', false); - self::assertSame($expectedPath, $subject->_call('canonicalizeAndCheckFileIdentifier', $fileIdentifier)); + $subject = new TestingHierarchicalFilesystemDriver(); + self::assertSame($expectedPath, $subject->canonicalizeAndCheckFileIdentifier($fileIdentifier)); } public static function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifierDataProvider(): array @@ -110,7 +110,7 @@ public static function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderId */ public function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier(string $expectedPath, string $identifier): void { - $subject = $this->getAccessibleMockForAbstractClass(AbstractHierarchicalFilesystemDriver::class, [], '', false); - self::assertSame($expectedPath, $subject->_call('canonicalizeAndCheckFolderIdentifier', $identifier)); + $subject = new TestingHierarchicalFilesystemDriver(); + self::assertSame($expectedPath, $subject->canonicalizeAndCheckFolderIdentifier($identifier)); } } diff --git a/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/TestingHierarchicalFilesystemDriver.php b/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/TestingHierarchicalFilesystemDriver.php new file mode 100644 index 000000000000..dab760c72ea0 --- /dev/null +++ b/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/TestingHierarchicalFilesystemDriver.php @@ -0,0 +1,275 @@ +