Issue Task Closed

#104005Mitigate PHPUnit `NameAlreadyInUseException`

Stefan Bürk 06/08/24, 15:35 updated 07/09/24, 15:35

Description

PHPUnit changed the way how double creation is handled
internal and emits now a exception if a manual defined
`mock class name` should be registered. In some places
within the unit tests manual mockclass names has been
used, because the names are needed for cross referencing
at a later point. For this, different approaches has
been used, for example hardcoded md4 hashes as strings
or creating hashes on static values like `md5(‘1)`,
and also reused same hashes in different places or in
tests using dataproviders. Thus leading now to the new
exception:

PHPUnit\Framework\MockObject\Generator\NameAlreadyInUseException
The name “b70551b2b2db62b6b15a9bbfcbd50614” is already in use

[1] https://github.com/sebastianbergmann/phpunit/pull/5804

Reviews 2