Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit's error handler is not registered if Symfony is booted in a "before class" hook #5873

Open
nikophil opened this issue Jun 18, 2024 · 0 comments
Labels
feature/test-runner CLI test runner type/bug Something is broken

Comments

@nikophil
Copy link
Contributor

Q A
PHPUnit version >= 10
PHP version 8.3 (any)
Installation Method Composer

Summary

Hi,

When using Symfony, if the kernel is booted in a "before class" hook, deprecations are not handled by PHPUnit's error handler. Actually, PHPUnit's error handler is not enabled at all, because another error handler is already registered.

I'm trying to open an issue here, to see if it would possible to mitigate the problem in PHPUnit?

Current behavior

Deprecation, for instance are not shown in PHPUnit's output.

How to reproduce

final class SomeTest extends KernelTestCase
{
    public static function setUpBeforeClass(): void
    {
        self::bootKernel(); // <== if this line is removed, the deprecation is displayed
    }

    public function testWithDeprecation(): void
    {
        @trigger_error('some deprecation', \E_USER_DEPRECATED);
        self::assertTrue(true);
    }
}

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants