-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] Add weak-verbose mode and match against message instead of test name #16789
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
Conversation
suite once a deprecation is triggered by the `MyTest::testMethod` test. | ||
In case you need to inspect the stack trace of a particular deprecation triggered | ||
by your unit tests, you can set the `SYMFONY_DEPRECATIONS_HELPER` env var to a | ||
regexp that matches this depreaction's message. For example, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: depreaction's -> deprecation's
026b8b7
to
62b3eff
Compare
typos fixed, thanks |
62b3eff
to
c27975d
Compare
@@ -64,7 +64,7 @@ public static function register($mode = false) | |||
$group = 'remaining'; | |||
} | |||
|
|||
if (isset($mode[0]) && '/' === $mode[0] && preg_match($mode, $class.'::'.$method)) { | |||
if (isset($mode[0]) && '/' === $mode[0] && preg_match($mode, $msg)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this preg_match is there. Is it an undocumented feature of the helper ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah no, it is documented
c27975d
to
cea79d1
Compare
👍 |
1 similar comment
👍 |
@@ -144,7 +144,7 @@ public static function register($mode = false) | |||
if (!empty($notices)) { | |||
echo "\n"; | |||
} | |||
if ('weak' !== $mode && ($deprecations['unsilenced'] || $deprecations['remaining'] || $deprecations['other'])) { | |||
if ('weak' !== $mode && 'weak-verbose' !== $mode && ($deprecations['unsilenced'] || $deprecations['remaining'] || $deprecations['other'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add those strings as constants esp. since $mode is part of the public api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consts added
cea79d1
to
a670ff1
Compare
👍 |
Thank you @nicolas-grekas. |
…t message instead of test name (nicolas-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [PhpUnitBridge] Add weak-verbose mode and match against message instead of test name | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14475 | License | MIT | Doc PR | - This is double a DX bug fix: - the weak-verbose allows showing messages but exit with 0 (see #14475) - matching against $class::$method was a mistake of mine: you can already `--filter` in phpunit to get by-test filtering but you can't select which message should be traced without this change. I stumbled upon this limitation while doing a Symfony 3 migration workshop... Commits ------- a670ff1 [PhpUnitBridge] Add weak-verbose mode and match against message instead of test name
…s upper bound" mode (nicolas-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [PhpUnitBridge] Replace "weak-verbose" by "deprecations upper bound" mode | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16789, #14475 | License | MIT | Doc PR | - This is a "new feature" that replaces a "new feature" not yet released but merged into 2.8.1. See #16789. It is way more flexible to be able to specify the upper bound of remaining deprecation notices that you allow in your test suite. This allows lowering this number while deprecations are removed, step after step. ping @wouterj @Tobion @craue @fabpot @stof Commits ------- 58cd3ee [PhpUnitBridge] Replace "weak-verbose" by "deprecations upper bound" mode
This is double a DX bug fix:
--filter
in phpunit to get by-test filtering but you can't select which message should be traced without this change. I stumbled upon this limitation while doing a Symfony 3 migration workshop...