Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SYMFONY_DEPRECATIONS_HELPER has no affect when defined in phpunit.xml.dist. #28726

Closed
@leevigraham

Description

@leevigraham

Symfony version(s) affected: 4.1.5

Description

Adding <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" /> to phpunit.xml.dist has no affect.

How to reproduce

Install the symfony skeleteon

composer create-project symfony/skeleton:4.1.* bug_app
cd bug_app
composer require --dev "symfony/phpunit-bridge:*"
php bin/phpunit

Add <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" /> to phpunit.xml.dist as per the configuration docs.

Create a new DeprecatedTest: https://github.com/leevigraham/symonfy-phpunit-bridge/blob/master/tests/DeprecatedTest.php

<?php

namespace App\Tests;

use PHPUnit\Framework\TestCase;

class DeprecatedTest extends TestCase
{
    public function testDeprecatedCode()
    {
        @trigger_error('This "Foo" method is deprecated.', E_USER_DEPRECATED);
        @trigger_error('The second argument of the "Bar" method is deprecated.', E_USER_DEPRECATED);
    }
}

Run php bin/phpunit again. Deprecation notices are shown.

Example Repo: https://github.com/leevigraham/symonfy-phpunit-bridge

Additional context

Screenshot of issue:

image

Running SYMFONY_DEPRECATIONS_HELPER=disabled php bin/phpunit produces expected output:

image

// @nicolas-grekas

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