Skip to content

Conversation

@greg0ire
Copy link
Member

This upgrades to PHPUnit 11 and addresses all newly emitted deprecations.

@greg0ire greg0ire marked this pull request as draft August 20, 2025 20:06
@greg0ire

This comment was marked as resolved.

@greg0ire

This comment was marked as resolved.

@greg0ire greg0ire force-pushed the upg-phpunit branch 2 times, most recently from bbd0ad5 to 9538859 Compare August 20, 2025 20:38
@greg0ire greg0ire marked this pull request as ready for review August 20, 2025 20:38

protected function tearDown(): void
{
if (! class_exists(PersistentObject::class)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really required?

// In case test is skipped, tearDown is called, but no setup may have run
if (! $conn) {
return;
}
does already handle this case gracefully, doesn't it?

Copy link
Member Author

@greg0ire greg0ire Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I didn't see this. But no, it no longer handles this gracefully when running the whole test suite, so maybe sharedConn now persists between tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh I debugged it, and sharedConn is always set.

Moreover, using this code:

    protected function tearDown(): void
    {
        try {
            parent::tearDown();
        } catch (\Throwable $e) {
            var_dump($e->getMessage());
        }
    }

With PHPUnit 10
prints this:

string(41) "Call to a member function clear() on null"

So the same issue exists with both versions of PHPUnit, it's just that for some reason, PHPUnit 10 swallows the exception.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced the commit that introduce this change with another that acts at the OrmFunctionalTestCase level, by also checking $this->_em.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that explains it probably: sebastianbergmann/phpunit#6281

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, nice find!

greg0ire and others added 6 commits August 21, 2025 13:39
self::returnValue() and self::onConsecutiveCalls() has been deprecated.
It seems that this could happen with PHPUnit 10, then tearDown() would
crash when calling `clear()` on null, but then PHPUnit 10 did not show
that exception.
@greg0ire greg0ire merged commit 21e9fcb into doctrine:3.5.x Aug 24, 2025
85 checks passed
@greg0ire greg0ire added this to the 3.5.3 milestone Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants