Skip to content

Conversation

greg0ire
Copy link
Member

No description provided.

$commandTester->getDisplay(),
);

restore_exception_handler();
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 still necessary? I thought we've fixed that. 😕

Copy link
Member Author

@greg0ire greg0ire Sep 12, 2025

Choose a reason for hiding this comment

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

It's sufficient to avoid the message in the commit message. If you have a better way, I'm interested.

Copy link
Member

Choose a reason for hiding this comment

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

Let's go with this instead symfony/symfony#53812 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

IIRC, the http-kernel component changes its behavior based on the availability of symfony/runtime (as it knows symfony/runtime manages the error handler already anyway for non-test usage).

Copy link
Member Author

Choose a reason for hiding this comment

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

@ostrolucky last time I tried that, it didn't work, but now it does. I must have messed up somehow.

PHPUnit 11 is not a fan of that:

	1) Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Compiler\CacheCompatibilityPassTest::testCacheConfigUsingServiceDefinedByApplication
	Error: Typed property MockObject_Region_05946efc::$__phpunit_state must not be accessed before initialization

	/home/greg/dev/DoctrineBundle/vendor/doctrine/orm/src/Cache/DefaultCacheFactory.php:58
	/tmp/sf_kernel_ba1be5d8f77bfc90137d39c20fb6e3be/var/cache/test/Container7B0Xppy/getDoctrine_Orm_DefaultConfigurationService.php:37
	/tmp/sf_kernel_ba1be5d8f77bfc90137d39c20fb6e3be/var/cache/test/Container7B0Xppy/Doctrine_Bundle_DoctrineBundle_Tests_DependencyInjection_Fixtures_TestKernel_zxZtpVTestContainer.php:93
	/tmp/sf_kernel_ba1be5d8f77bfc90137d39c20fb6e3be/var/cache/test/Container7B0Xppy/getDoctrine_Orm_DefaultEntityManagerService.php:25
	/tmp/sf_kernel_ba1be5d8f77bfc90137d39c20fb6e3be/var/cache/test/Container7B0Xppy/getDoctrine_Orm_DefaultEntityManagerService.php:22
	/home/greg/dev/DoctrineBundle/vendor/doctrine/orm/src/EntityManager.php:162
	/home/greg/dev/DoctrineBundle/src/CacheWarmer/DoctrineMetadataCacheWarmer.php:37
	/home/greg/dev/DoctrineBundle/vendor/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php:41
	/home/greg/dev/DoctrineBundle/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:96
	/home/greg/dev/DoctrineBundle/vendor/symfony/http-kernel/Kernel.php:520
	/home/greg/dev/DoctrineBundle/vendor/symfony/http-kernel/Kernel.php:718
	/home/greg/dev/DoctrineBundle/vendor/symfony/http-kernel/Kernel.php:120
	/home/greg/dev/DoctrineBundle/tests/DependencyInjection/Compiler/CacheCompatibilityPassTest.php:80

Anyway, do not mock what you do not own ™️
PHPUnit 11 warns about tests that involvke Symfony kernels:

> Test code or tested code did not remove its own exception handlers

See symfony/symfony#53812
@greg0ire greg0ire merged commit c3ce14c into doctrine:2.16.x Sep 12, 2025
14 checks passed
@greg0ire greg0ire added this to the 2.16.3 milestone Sep 12, 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.

4 participants