Skip to content

PHPUnitBridge ignoreFile option #16768

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

Merged
merged 1 commit into from
May 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions components/phpunit_bridge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,43 @@ Here is a summary that should help you pick the right configuration:
| | cannot afford to use one of the modes above. |
+------------------------+-----------------------------------------------------+

Ignore Deprecations
...................

.. versionadded:: 6.1

The ``ignoreFile`` feature was introduced in Symfony 6.1.

If your application has some deprecations that you can't fix for some reasons,
you can tell Symfony to ignore them.

You need first to create a simple text file with a list of ignore patterns. Each
pattern is a regular expression.

Lines beginning with an hash (#) will be considered comments:

.. code-block:: terminal

# This file contains patterns to be ignored while testing for use of
# deprecated code.

%The "Symfony\\Component\\Validator\\Context\\ExecutionContextInterface::.*\(\)" method is considered internal Used by the validator engine\. (Should not be called by user\W+code\. )?It may change without further notice\. You should not extend it from "[^"]+"\.%
%The "PHPUnit\\Framework\\TestCase::addWarning\(\)" method is considered internal%

Then, you can run the following command to use that file and ignore those deprecations:

.. code-block:: terminal

$ SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/baseline-ignore' ./vendor/bin/simple-phpunit

Baseline Deprecations
.....................

If your application has some deprecations that you can't fix for some reasons,
you can tell Symfony to ignore them. The trick is to create a file with the
allowed deprecations and define it as the "deprecation baseline". Deprecations
inside that file are ignored but the rest of deprecations are still reported.
You can also take a snapshot of deprecations currently triggered by your application
code, and ignore those during your test runs, still reporting newly added ones.
The trick is to create a file with the allowed deprecations and define it as the
"deprecation baseline". Deprecations inside that file are ignored but the rest of
deprecations are still reported.

First, generate the file with the allowed deprecations (run the same command
whenever you want to update the existing file):
Expand Down