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

History 210

  1. Gerrit Code Review pushed patch set 1 for main to change 84530 status New Under Review 06/08/24, 15:39

  2. Gerrit Code Review pushed patch set 1 for 12.4 to change 84531 06/08/24, 15:42

  3. Gerrit Code Review pushed patch set 2 for main to change 84530 06/08/24, 15:42

  4. Gerrit Code Review pushed patch set 3 for main to change 84530 06/10/24, 15:03

  5. Gerrit Code Review pushed patch set 4 for main to change 84530 06/10/24, 15:03

  6. Gerrit Code Review pushed patch set 2 for 12.4 to change 84531 06/10/24, 15:06

  7. Gerrit Code Review pushed patch set 5 for main to change 84530 06/10/24, 15:06

  8. Gerrit Code Review pushed patch set 3 for 12.4 to change 84531 06/10/24, 15:16

  9. Stefan Bürk commented and changed status Under Review Resolved done 0 % 100 % 06/10/24, 15:45

    Applied in changeset commit:e2aff12c4222ee5d7c85b70af007fa17afd6068b.

  10. Benni Mack changed status Resolved Closed 07/09/24, 15:35