Skip to content
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

Output buffer - fix 5851 #5852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kkmuffme
Copy link

@kkmuffme kkmuffme commented Jun 2, 2024

Fix #5851

@kkmuffme kkmuffme marked this pull request as ready for review June 2, 2024 20:44
Test code or tested code closed output buffers other than its own

%sIssue5342Test.php:%i
2) PHPUnit\TestFixture\Issue5342Test::testFailure
Copy link
Owner

Choose a reason for hiding this comment

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

Is this escalation from risky test to test failure intentional?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. I didn't plan that initially, but as I created the PR, I realized that more likely than not these ob issues lead to unexpected and non-trustworthy test results in many cases. Keeping them "risky" would not convey the severity of the issue here in my opinion.

I did keep "risky" in some cases (as you can see) though, were the behavior is usually not much different than if there were no ob issue at all.


Due to the nature of the buffer, the resulting logic/code is unfortunately a bit ugly, so feedback is very welcome.

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 74.76636% with 27 lines in your changes are missing coverage. Please review.

Project coverage is 92.22%. Comparing base (3e6c0dc) to head (6e8e56a).

Files Patch % Lines
src/Framework/TestCase.php 74.76% 27 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5852      +/-   ##
============================================
- Coverage     92.32%   92.22%   -0.10%     
- Complexity     6555     6597      +42     
============================================
  Files           699      699              
  Lines         19775    19869      +94     
============================================
+ Hits          18257    18324      +67     
- Misses         1518     1545      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

private function stopOutputBuffering(): bool
{
$bufferingLevel = ob_get_level();
$bufferingLevel = ob_get_level();
Copy link
Contributor

Choose a reason for hiding this comment

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

At first, it is a bugfix, so it must target the lowest supported and problematic branch.

Also, it seems this PR fixes several ob issues. I would like to see a separate commit for each issue ("Fix ob is not cleanable", ...) so each can be reviewed individually.

Copy link
Author

Choose a reason for hiding this comment

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

At first, it is a bugfix, so it must target the lowest supported and problematic branch.

Could you give me a quick hint, since this is my first PR for phpunit - which branch would that be? Rebasing/Rebranching from that and implementing it on that branch is sufficient or is there anything else?

Also, it seems this PR fixes several ob issues. I would like to see a separate commit for each issue ("Fix ob is not cleanable", ...) so each can be reviewed individually.

Practically this isn't possible except for a single case (the error added for ob_flush/ob_clean), since all changes are needed for any of these cases to work correctly. Separating it would make it more confusing than it already is - due to the nature of output buffering.
In case you insist, could you please tell me the exact commits/how you want it separated, then I can see if it's possible or tell you exactly why it's not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various output buffer issues
3 participants