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][HttpKernel]Always display container deprecations in simple phpunit#29519

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

@l-vo
Copy link
Contributor

@l-vol-vo commentedDec 8, 2018
edited
Loading

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

When the container is not built or not fresh, simple-phpunit may trigger deprecations which occured during container built. If simple-phpunit is launched again, the deprecations are not displayed since the container hasn't be built this time.

Deprecations can make tests fail. So the behavior is currently inconsistent. With the same code base, the tests may pass if the container has been built before and may fail if the container is built during the process.

The suggested fix is to retrieve container compile deprecations from a file created by Symfony. It's the file which is used to display container compile deprecations in Logger data collector.

Some deprecations are generated during cache warmup. Without cache warmup, these deprecations can be triggered from anywhere. For this reason, without cache warmup, we can't memorize them to display them on all test launches.So to keep test launches consistent, it could be a good practice to warmup the cache before.

Note: since phpunit-bridge create a new phpunit project with a phpunit-bridge dependency, the phpunit-bridge version used for the CI tests hasn't the modification of this PR. So the tests fail. Reporting theDeprecationErrorHandler modifications in the created phpunit project allows tests to be successful.

Some very minor bugs has been detected after#29211; it could be a good think to fix the bugs treated by#31478 before merging this PR.

maxhelias reacted with eyes emoji
@nicolas-grekas
Copy link
Member

This should be considered as a new feature IMHO.
Since this might be too specific to Symfony functional test cases, would it make sense to move this feature to the KernelTestCase instead of the bridge?

@nicolas-grekasnicolas-grekas added this to thenext milestoneDec 8, 2018
@l-vol-vo changed the titleAlways display container deprecations in simple phpunit[PhpunitBridge][HttpKernel]Always display container deprecations in simple phpunitDec 10, 2018
@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch from478240a to7dbde2bCompareDecember 10, 2018 20:40
@l-vo
Copy link
ContributorAuthor

@nicolas-grekas I'm not sure I fully understand. Do you mean that KernelTestCase should catch container compile deprecation and display it (although other deprecations will be displayed by PHPUnit bridge) ?

@nicolas-grekas
Copy link
Member

KernelTestCase could eg open that file and @trigger_error() them - or call the deprecation handler if possible?

@l-vo
Copy link
ContributorAuthor

I can't use trigger_error since I would lose original line number information. But maybe I can deal with registered error handler. I'm going to try that, thank you :)

@l-vo
Copy link
ContributorAuthor

status: needs work

@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch from7dbde2b to09feeaeCompareDecember 13, 2018 20:58
@l-vol-vo changed the base branch from3.4 tomasterDecember 13, 2018 20:59
@l-vol-vo changed the title[PhpunitBridge][HttpKernel]Always display container deprecations in simple phpunitWIP [PhpunitBridge][HttpKernel]Always display container deprecations in simple phpunitDec 13, 2018
@l-vol-vo changed the titleWIP [PhpunitBridge][HttpKernel]Always display container deprecations in simple phpunit[PhpunitBridge][HttpKernel]Always display container deprecations in simple phpunitDec 13, 2018
@l-vo
Copy link
ContributorAuthor

status: needs work

@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch 4 times, most recently from4763a3e to9197928CompareDecember 30, 2018 17:47
@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch 3 times, most recently fromf819427 to14db14fCompareJanuary 2, 2019 09:57
@fabpot
Copy link
Member

@l-vo What's the status of your PR?

@l-vo
Copy link
ContributorAuthor

@fabpot there is more work than I originally thought. I recently didn't have the time to continue this PR but I didn't forget it :) I'm going back to work on it very soon :)

@fabpot
Copy link
Member

@l-vo thanks for the feedback.

@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch 2 times, most recently from8071a01 tod2749e4CompareApril 28, 2019 15:58
@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch 2 times, most recently from268e856 tocadca3aCompareMay 16, 2019 15:54
@l-vol-voforce-pushed thealways_display_container_deprecations_in_simple-phpunit branch fromcadca3a tobf17514CompareMay 16, 2019 16:03
@l-vo
Copy link
ContributorAuthor

status: needs review

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedJul 8, 2019
edited
Loading

Sorry I didn't look close enough before. There is no reason why the phpunit-bridge should know anything about KernelTestCase. Let's find a proper way that would decouple things. There is already some code infrastructure that deals with serialized deprecations passed via messages. Can't we improve this to achieve what is needed here?

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.

I think this shouldn't be on phpunit-bridge's side.
Let's have some logic in a base test-case (KernelTestCase?) that triggers those to load the file and trigger the deprecations there.

@l-vo
Copy link
ContributorAuthor

l-vo commentedAug 3, 2019

@nicolas-grekas I'm not sure to understand. If we put the logic into KernelTestCase (without coupling with phpunit-bridge), we'll lose the logic of theDeprecation class of phpunit-bridge ?

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedAug 3, 2019
edited
Loading

You mean: being able to differentiate direct vs indirect deprecations, right? But can't we trigger a serialized message asallowed by the bridge to fix that?

@l-vo
Copy link
ContributorAuthor

l-vo commentedAug 9, 2019

@nicolas-grekas sorry if I miss something... We can trigger a serialized message, but we must determine in the bridge the message source. It's what is donehere, but it's also what introduces the coupling with KernelTestCase.

@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
@nicolas-grekasnicolas-grekas modified the milestones:4.4,nextNov 5, 2019
@nicolas-grekas
Copy link
Member

I'm closing because this would apparently add a lot of complexity for a case that happens to be solvable in other ways. There are other strategies to get the deprecations. It would be nice to achieve the goal here, but not at all costs.
Thanks for giving it a try.

@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas requested changes

@dunglasdunglasAwaiting requested review from dunglas

@lyrixxlyrixxAwaiting requested review from lyrixx

@srozesrozeAwaiting requested review from sroze

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

4 participants

@l-vo@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp