Skip to content

Commit

Permalink
[TASK] Mock interfaces instead of abstract classes
Browse files Browse the repository at this point in the history
`getMockForAbstractClass` has been (soft-)deprecated in PHPUnit 10.1:
sebastianbergmann/phpunit#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 <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Stefan B�rk <[email protected]>
Tested-by: Stefan B�rk <[email protected]>
  • Loading branch information
oliverklee authored and lolli42 committed Aug 8, 2023
1 parent f022bd4 commit 7ab7d97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tests/Unit/Mvc/Property/PropertyMappingConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 7ab7d97

Please sign in to comment.