Skip to content

[phpunit-bridge] DeprecationErrorHandler doesn't catch deprecation triggered by SymfonyTestListenerTrait #26476

Closed
@bojanz

Description

@bojanz

PHPUnit 6.5.7, Symfony 3.4 via Drupal 8.5.0

Testing deprecation messages locally, I keep getting "Legacy deprecation notices (6)" instead of the expected "Remaining deprecation notices (6)" followed by the actual notices.

Jumping into DeprecationErrorHandler, I have found that the problem is here:

if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
                if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) {

The second IF parses the message, but it's never triggered. If I replace the condition with TRUE, I get the expected behavior. The condition fails because $trace[$i]['class'] on my machine points to Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV6, not the aliased version.

debug_backtrace() seems to always return unaliased classes, so how is the condition expected to work? What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions