[PR #8552] Fix remaining warnings from the phpunit9 upgrade #11063

Closed
opened 2026-01-22 16:09:35 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/8552

State: closed
Merged: Yes


Some tests were still using deprecated assertion and mocking methods,
resulting in a long list of warnings in the phpunit output.

This commit resolves all the warnings:

  • Fixes a couple of test names in @depends tags (presumably these
    tests were renamed at some point for coding standards).

  • Changes how mocks are configured when asserting the same method
    is called multiple times with a sequence of arguments / sequence
    of return values. The old ->at expectation is deprecated because
    it can be brittle and give unreliable results. Some of this
    mocking could probably still be refactored further, but my focus
    was on solving the deprecation with the existing setup.

  • Removes one use of prophecy for mocking, in favour of using
    phpunit mock objects. Prophecy now requires an extra composer
    dependency and a trait which seems overkill given it was only
    used in one place.

  • Updates to the new names for assertFileExists and assertRegExp
    (and their not versions) - these are functionally equivalent.

  • Replaces the last few references to old PHPUnit_Framework_XXX
    classes with their namespaced equivalent. These were mostly in
    comments, or in native php assert() statements that were sanity
    checking mocked object types. These asserts are probably redundant
    (and are clearly not running in CI since the classes they referenced
    no longer exist).

**Original Pull Request:** https://github.com/doctrine/orm/pull/8552 **State:** closed **Merged:** Yes --- Some tests were still using deprecated assertion and mocking methods, resulting in a long list of warnings in the phpunit output. This commit resolves all the warnings: * Fixes a couple of test names in `@depends` tags (presumably these tests were renamed at some point for coding standards). * Changes how mocks are configured when asserting the same method is called multiple times with a sequence of arguments / sequence of return values. The old `->at` expectation is deprecated because it can be brittle and give unreliable results. Some of this mocking could probably still be refactored further, but my focus was on solving the deprecation with the existing setup. * Removes one use of prophecy for mocking, in favour of using phpunit mock objects. Prophecy now requires an extra composer dependency and a trait which seems overkill given it was only used in one place. * Updates to the new names for assertFileExists and assertRegExp (and their `not` versions) - these are functionally equivalent. * Replaces the last few references to old PHPUnit_Framework_XXX classes with their namespaced equivalent. These were mostly in comments, or in native php `assert()` statements that were sanity checking mocked object types. These asserts are probably redundant (and are clearly not running in CI since the classes they referenced no longer exist).
admin added the pull-request label 2026-01-22 16:09:35 +01:00
admin closed this issue 2026-01-22 16:09:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#11063