From 7ab7d97dd391a6ea22470b9067a8e15b810c987a Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 7 Aug 2023 18:37:41 +0200 Subject: [PATCH] [TASK] Mock interfaces instead of abstract classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `getMockForAbstractClass` has been (soft-)deprecated in PHPUnit 10.1: https://github.com/sebastianbergmann/phpunit/issues/5241 Hence, we should replace its usages to follow current best practices. This changes tackles the classes where we can mock an interface instead of an abstract class, allowing us to use `createMock` instead of `getMockForAbstractClass`. Resolves: #101609 Related: #101601 Releases: main, 12.4 Change-Id: I995f70d779a1bc6251bc4479c3dcb2ee548314f1 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80455 Tested-by: core-ci Tested-by: Christian Kuhn Reviewed-by: Christian Kuhn Reviewed-by: Stefan B�rk Tested-by: Stefan B�rk --- Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php b/Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php index d80aa809..77c2d26b 100644 --- a/Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php +++ b/Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php @@ -21,8 +21,8 @@ use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration as ExtbasePropertyMappingConfiguration; -use TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator; use TYPO3\CMS\Extbase\Validation\Validator\NotEmptyValidator; +use TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface; use TYPO3\CMS\Extbase\Validation\ValidatorResolver; use TYPO3\CMS\Form\Domain\Model\FormDefinition; use TYPO3\CMS\Form\Domain\Model\FormElements\FileUpload; @@ -266,7 +266,7 @@ public function afterBuildingFinishedSetsStoragePathToUserUploadIfNeitherSaveToF public function afterBuildingFinishedCopiesValidators(): void { // Some other Validator - $otherValidator = $this->getMockForAbstractClass(AbstractValidator::class); + $otherValidator = $this->createMock(ValidatorInterface::class); // Don't add any validators for now $validators = new \SplObjectStorage();