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] deprecate the testLegacy test name prefix#21140

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

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromxabbuh:issue-18755
Jan 6, 2017

Conversation

@xabbuh
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#18755
LicenseMIT
Doc PR

}
}

if ($testinstanceof \PHPUnit_Framework_TestCase &&0 ===strpos($test->getName(),'testLegacy') &&empty($test->getTestResultObject()->warningCount())) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

when the annotation is in place, we should not trigger the warning. What about the other cases?
From DeprecationErrorHandler:

                }elseif (0 ===strpos($method,'testLegacy')                    ||0 ===strpos($method,'provideLegacy')                    ||0 ===strpos($method,'getLegacy')                    ||strpos($class,'\Legacy')

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Adding the warning based on class/method names does work. I am looking into how to do that (if possible) based on the data transformer.

@xabbuh
Copy link
MemberAuthor

Status: Needs work


publicfunctionaddWarning(\PHPUnit_Framework_Test$test,\PHPUnit_Framework_Warning$e,$time)
{
if ($testinstanceof \PHPUnit_Framework_TestCase) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

why do we need this check here, we already typehint the parameter

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The type hint is for\PHPUnit_Framework_Test, but not\PHPUnit_Framework_TestCase.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

damn, you are right 👍

@xabbuh
Copy link
MemberAuthor

TheprovideLegacy andgetLegacy prefixes are not used to make the test belong to the legacy group, but can be used if your data provider triggers deprecations itself. This is something that needs to be fixed in the documentation (seesymfony/symfony-docs#7312 for the bug report). Thus, this PR is finished and ready to be reviewed.

Status: Needs review

@xabbuh
Copy link
MemberAuthor

After talking to@nicolas-grekas the warnings will now only be triggered if the@group annotation was not used. So you can get rid of the warnings simply by adding the group without the need to rename your test methods.

@xabbuhxabbuhforce-pushed theissue-18755 branch 2 times, most recently from693cf86 to2448fbcCompareJanuary 3, 2017 19:09
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍 with minor comments

}

if ($testinstanceof \PHPUnit_Framework_TestCase &&0 ===strpos($test->getName(),'testLegacy') && !isset($this->testsWithWarnings[$test->getName()]) && !in_array('legacy',$groups,true)) {
$test->getTestResultObject()->addWarning($test,new \PHPUnit_Framework_Warning('Using the testLegacy prefix to mark tests as legacy is deprecated since version 3.3 and will be removed in 4.0. Use the "@group legacy" notation instead to add the test to the legacy group.'),$time);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

quotes around "testLegacy"

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

quotes added in both places

}

if ($testinstanceof \PHPUnit_Framework_TestCase &&strpos($className,'\Legacy') && !isset($this->testsWithWarnings[$test->getName()]) && !in_array('legacy',$classGroups,true)) {
$test->getTestResultObject()->addWarning($test,new \PHPUnit_Framework_Warning('Using the Legacy prefix to mark all tests of a class as legacy is deprecated since version 3.3 and will be removed in 4.0. Use the "@group legacy" notation instead to add the test to the legacy group.'),$time);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

quotes around "Legacy"

@nicolas-grekas
Copy link
Member

Thank you@xabbuh.

@nicolas-grekasnicolas-grekas merged commit21b72dd intosymfony:masterJan 6, 2017
nicolas-grekas added a commit that referenced this pull requestJan 6, 2017
…fix (xabbuh)This PR was merged into the 3.3-dev branch.Discussion----------[PhpUnitBridge] deprecate the testLegacy test name prefix| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#18755| License       | MIT| Doc PR        |Commits-------21b72dd deprecate the Legacy/testLegacy test name prefix
@xabbuhxabbuh deleted the issue-18755 branchJanuary 6, 2017 11:34
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestApr 24, 2017
…, javiereguiluz)This PR was merged into the master branch.Discussion----------Do not document deprecated legacy test mechanismsseesymfony/symfony#21140Commits-------c2c680a Fixed a minor typo6f546aa do not document deprecated legacy test mechanisms
@fabpotfabpot mentioned this pull requestMay 1, 2017
xabbuh added a commit to xabbuh/symfony that referenced this pull requestMay 21, 2017
fabpot added a commit that referenced this pull requestMay 21, 2017
This PR was merged into the 3.3 branch.Discussion----------[PhpUnitBridge] add changelog entries for#21140| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#21140| License       | MIT| Doc PR        |Commits-------c83c5bc [PhpUnitBridge] add changelog entries for#21140
nicolas-grekas added a commit that referenced this pull requestMay 22, 2017
* 3.3:  [Serializer] Remove a useless legacy annotation  Fixed extra semi-colon  fix docblock position  [DependencyInjection] remove unused variable  [PhpUnitBridge] add changelog entries for#21140  [DI] Remove dead service_container checks
nicolas-grekas added a commit that referenced this pull requestMay 22, 2017
* 3.4:  [Serializer] Remove a useless legacy annotation  Fixed extra semi-colon  fix docblock position  [DependencyInjection] remove unused variable  [PhpUnitBridge] add changelog entries for#21140  [DI] Remove dead service_container checks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@OskarStarkOskarStarkOskarStark left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

4 participants

@xabbuh@nicolas-grekas@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp