[TASK] Mitigate PHPUnit `NameAlreadyInUseException`
PHPUnit changed the way how double creation is handled internally and now emits an exception if a manually defined `mock class name` should be registered. In some places within the unit tests, manual mock class names have been used, because the names are needed for cross referencing at a later point. For this, different approaches have been used, for example hardcoded MD5 hashes as strings or creating hashes of static values like `md5('1')`, and also reused hashes in different places or in tests using data providers. This now leads to an exception: PHPUnit\Framework\MockObject\Generator\NameAlreadyInUseException The name "b70551b2b2db62b6b15a9bbfcbd50614" is already in use This change mitigates the issue by using `StringUtility::getUniqueId('somePrefix')` as is already done in other places. As a sideeffect, four phpstan baseline entries can be removed. Used command(s): Build/Scripts/runTests.sh -s phpstanGenerateBaseline [1] https://github.com/sebastianbergmann/phpunit/pull/5804 Resolves: #104005 Releases: main, 12.4 Change-Id: Icc558844275c9ae9f67a0e7c20daa318f5ad6b41 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84530 Reviewed-by:Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Andreas Wolf <andreas.wolf@typo3.org> Reviewed-by:
Andreas Wolf <andreas.wolf@typo3.org>
parent
1cbcf824
Please register or sign in to comment