Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code#35178

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@fancyweb
Copy link
Contributor

@fancywebfancyweb commentedJan 2, 2020
edited
Loading

QA
Branch?3.4
Bug fix?no
New feature?no
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

Risky errors when there are no assertions are added before the test end listeners are called (ie, before the code in endTest is executed) so forcing beStrictAboutTestsThatDoNotTestAnything to false when there is a expectedDeprecation annotation is enough.

If the goal is to reset the value to the original value, then I think we should not do it since we basically "lie" to the next listeners. Let's assume that when a test expect a deprecation, it can have 0 assertions. Also this flag is not used anymore by PHPUnit after we reset it.

Ref#21786 btw

@nicolas-grekas
Copy link
Member

Let's assume that when a test expect a deprecation, it can have 0 assertions

what does that mean? We do have tests that expect deprecations, and have many other assertions in the body of the test case.

@nicolas-grekas
Copy link
Member

Let's assume that when a test expect a deprecation, it can have 0 assertions

does this mean that a test that makes no assertion won't be reported as risky as soon as it also expects deprecations?
What's the current behavior, and why change it?

@fancyweb
Copy link
ContributorAuthor

what does that mean? We do have tests that expect deprecations, and have many other assertions in the body of the test case.

Yes and that is fine. Removing this code does not change anything about that. The only thing that is changed is that we don't reset the original "beStrictAboutTestsThatDoNotTestAnything" flag value to true (when it was true) at the end of each test anymore.

does this mean that a test that makes no assertion won't be reported as risky as soon as it also expects deprecations?
What's the current behavior, and why change it?

Yes and that is the current behavior. When a test expects a deprecation we always set the "beStrictAboutTestsThatDoNotTestAnything" flag to false (that overrides it if it was true). So a test that expects an annotation can never be considered as risky if it makes no assertion. The current behavior is not changed.

I would like to have@xabbuh input about this.

@fancywebfancywebforce-pushed thephpunit-bridge-remove-useless-code branch from1ad1677 tofb48bbcCompareJanuary 14, 2020 14:28
@nicolas-grekas
Copy link
Member

Thank you@fancyweb.

nicolas-grekas added a commit that referenced this pull requestJan 20, 2020
…nneeded code (fancyweb)This PR was merged into the 3.4 branch.Discussion----------[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Risky errors when there are no assertions are added before the test end listeners are called (ie, before the code in endTest is executed) so forcing beStrictAboutTestsThatDoNotTestAnything to false when there is a expectedDeprecation annotation is enough.If the goal is to reset the value to the original value, then I think we should not do it since we basically "lie" to the next listeners. Let's assume that when a test expect a deprecation, it can have 0 assertions. Also this flag is not used anymore by PHPUnit after we reset it.Ref#21786 btwCommits-------fb48bbc [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
@nicolas-grekasnicolas-grekas merged commitfb48bbc intosymfony:3.4Jan 20, 2020
@fancywebfancyweb deleted the phpunit-bridge-remove-useless-code branchJanuary 20, 2020 12:39
@xabbuh
Copy link
Member

Yes and that is the current behavior. When a test expects a deprecation we always set the "beStrictAboutTestsThatDoNotTestAnything" flag to false (that overrides it if it was true). So a test that expects an annotation can never be considered as risky if it makes no assertion. The current behavior is not changed.

I don't know why we had the removed code here initially anyway, but as long as this still works, the changes look good to me.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@fancyweb@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp