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

Fix KernelTestCase compatibility for PhpUnit 8#30084

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

@alexander-schranz
Copy link
Contributor

@alexander-schranzalexander-schranz commentedFeb 5, 2019
edited
Loading

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

As the PhpUnit 8 Testcase has different return types as PhpUnit 7 there need to be 2 different classes to support both PhpUnit 8 and PhpUnit 7. With a class alias we can then change which version is used based on the PhpUnit Version constant. The fix is a little bit hacky but to support different major versions I see no other way.

Not sure as we can't upgrade symfony/symfony to PhpUnit 8 how we can create a TestCase for this change.

@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-compatibility branch 2 times, most recently from203cf61 toddf2a25CompareFebruary 5, 2019 22:17
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-compatibility branch fromddf2a25 toe216c0dCompareFebruary 5, 2019 22:26
@alexander-schranzalexander-schranz changed the titleAdd compatibility for phpunit 8Fix compatibility for phpunit 8Feb 5, 2019
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-compatibility branch 5 times, most recently from9850f7d to254cd15CompareFebruary 5, 2019 22:54
@alexander-schranzalexander-schranz changed the titleFix compatibility for phpunit 8Fix compatibility for phpunit 8 for KernelTestCaseFeb 5, 2019
@alexander-schranzalexander-schranz changed the titleFix compatibility for phpunit 8 for KernelTestCaseFix KernelTestCase compatibility for phpunit 8Feb 5, 2019
@alexander-schranzalexander-schranz changed the titleFix KernelTestCase compatibility for phpunit 8Fix KernelTestCase compatibility for PhpUnit 8Feb 6, 2019
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-compatibility branch 2 times, most recently fromd26f2bf toff5de16CompareFebruary 6, 2019 13:21
@nicolas-grekas
Copy link
Member

Instead of doing this change, would adding the@after annotation onensureKernelShutdown work?

alexander-schranz and andrew-demb reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneFeb 7, 2019
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-compatibility branch fromff5de16 to83a56a0CompareFebruary 7, 2019 08:59
@alexander-schranz
Copy link
ContributorAuthor

@nicolas-grekas sounds like a good idea! Did change it.

*
* Shuts the kernel down if it was used in the test.
*/
protectedstaticfunctionensureKernelShutdown()

Choose a reason for hiding this comment

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

could you please confirm it works even if this method is protected?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Can confirm it was called in a simple test extending the KernelTestCase.

nicolas-grekas reacted with thumbs up emoji
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.

There is potential BC break, if ppl callparent::tearDown(). We could work around by implementing__call(). Not sure it's worth it, wdyt?

@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedFeb 7, 2019
edited
Loading

@nicolas-grekas tried it but __call seems never be called when parent::tearDown() is called it seems directly calling the PhpUnit teardown. (https://wtools.io/php-sandbox/6y)

@nicolas-grekas
Copy link
Member

it seems directly calling the PhpUnit teardown

all is fine then, great!

@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedFeb 7, 2019
edited
Loading

@nicolas-grekas and the@after seems to be called after thetearDown so there should be no problems if the kernel is still needed in the tearDown.

nicolas-grekas reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commit83a56a0 intosymfony:3.4Feb 8, 2019
nicolas-grekas added a commit that referenced this pull requestFeb 8, 2019
…schranz)This PR was merged into the 3.4 branch.Discussion----------Fix KernelTestCase compatibility for PhpUnit 8| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  |no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#30071| License       | MIT| Doc PR        |As the PhpUnit 8 Testcase has different return types as PhpUnit 7 there need to be 2 different classes to support both PhpUnit 8 and PhpUnit 7. With a class alias we can then change which version is used based on the PhpUnit Version constant. The fix is a little bit hacky but to support different major versions I see no other way.Not sure as we can't upgrade symfony/symfony to PhpUnit 8 how we can create a TestCase for this change.Commits-------83a56a0 Fix phpunit 8 compatibility
@alexander-schranzalexander-schranz deleted the feature/phpunit-8-compatibility branchFebruary 8, 2019 12:10
@Tobion
Copy link
Contributor

This is a huge BC break and must be reverted. It's common practice to overwritetearDown to not shut down the kernel. This won't work anymore with this change.

gmponos reacted with thumbs up emojiandrew-demb reacted with confused emoji

nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull requestFeb 9, 2019
…t 8 (alexander-schranz)"This reverts commita36dc51, reversingchanges made todb445c4.
@nicolas-grekas
Copy link
Member

:( thanks for the review.
Here is the follow up:#30124

fabpot added a commit that referenced this pull requestFeb 12, 2019
…las-grekas)This PR was squashed before being merged into the 3.4 branch (closes#30124).Discussion----------Fix KernelTestCase compatibility for PhpUnit 8 (bis)| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Follow up of#30084 and@Tobion's comment there.Fabbot failure is a false-positive.Commits-------1077df6 Fix KernelTestCase compatibility for PhpUnit 8 (bis)
This was referencedMar 3, 2019
@garakgarak mentioned this pull requestMar 7, 2019
fabpot added a commit that referenced this pull requestMar 9, 2019
This PR was merged into the 3.4 branch.Discussion----------compatibility with phpunit8This basically adds the same phpunit8 compatibility layer added in#30084 (but for other test classes)See also discussion in#30071| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#30071| License       | MIT| Doc PR        | noneCommits-------5ef254f compatibility with phpunit8
@symfonysymfony deleted a comment fromunicornazMar 4, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

5 participants

@alexander-schranz@nicolas-grekas@Tobion@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp