sebastianbergmann / phpunit

The PHP Unit Testing framework.
https://phpunit.de/
BSD 3-Clause "New" or "Revised" License
19.68k stars 2.2k forks source link

Suppressed deprecations not included in baseline when ignoreSuppressionOfDeprecations is true #5847

Closed winterwald closed 2 months ago

winterwald commented 4 months ago
Q A
PHPUnit version 11.1.3
PHP version 8.3.7
Installation Method Composer

Summary

I encountered unexpected behavior when using the Baseline Generator with suppressed deprecations. In my project, deprecation notices are suppressed using @trigger_error('This is a test deprecation', E_USER_DEPRECATED);. When configuring PHPUnit with ignoreSuppressionOfDeprecations="true", I expected suppressed deprecations to be included in the generated baseline file. However, these suppressed deprecations are not included in the baseline. Consequently, rerunning PHPUnit with that baseline fails because the suppressed deprecations are still triggered.

But the deprecations end up in baseline if I change differen attribute ignoreSuppressionOfPhpWarnings="true".

Current behavior

Suppressed deprecations are not included in the baseline file, even with ignoreSuppressionOfPhpWarnings="true" added to the phpunit/source in PHPUnit configuration file.

How to reproduce

I set up an example project using only PHPUnit 11.1.0 to demonstrate the issue.

You can find it here: https://github.com/winterwald/phpunit-baseline-example

Refer to the README file for additional details.

Expected behavior

If I add ignoreSuppressionOfDeprecations="true" to phpunit/source in configuration file then suppressed deprecations should end up in baseline file.

Used composer packages

composer info | sort  
myclabs/deep-copy                  1.11.1 Create deep copies (clones) of your objects
nikic/php-parser                   5.0.2  A PHP parser written in PHP
phar-io/manifest                   2.0.4  Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1  Library for handling version information and constraints
phpunit/php-code-coverage          11.0.3 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          5.0.0  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                5.0.0  Invoke callables with a timeout
phpunit/php-text-template          4.0.0  Simple template engine.
phpunit/php-timer                  7.0.0  Utility class for timing
phpunit/phpunit                    11.1.3 The PHP Unit Testing framework.
sebastian/cli-parser               3.0.1  Library for parsing CLI options
sebastian/code-unit                3.0.0  Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 4.0.0  Looks up which function or method a line of code belongs to
sebastian/comparator               6.0.0  Provides the functionality to compare PHP values for equality
sebastian/complexity               4.0.0  Library for calculating the complexity of PHP code units
sebastian/diff                     6.0.1  Diff implementation
sebastian/environment              7.1.0  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 6.0.1  Provides the functionality to export PHP variables for visualization
sebastian/global-state             7.0.1  Snapshotting of global state
sebastian/lines-of-code            3.0.0  Library for counting the lines of code in PHP source code
sebastian/object-enumerator        6.0.0  Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         4.0.0  Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        6.0.0  Provides functionality to recursively process PHP variables
sebastian/type                     5.0.0  Collection of value objects that represent the types of the PHP type system
sebastian/version                  5.0.0  Library that helps with managing the version number of Git-hosted PHP projects
theseer/tokenizer                  1.2.3  A small library for converting tokenized PHP source code into XML and potentially other formats
winterwald commented 4 months ago

I tried to resolve the issue for PHPUnit 10.5 (oldest supported version having baseline support) myself: https://github.com/sebastianbergmann/phpunit/pull/5848

winterwald commented 2 months ago

Same issue was resolved with https://github.com/sebastianbergmann/phpunit/pull/5887 . Closing this one.