Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Mar 12, 2024

file IO largely depends on hardware and performance can vary a lot. it needs to be avoided at all cost.
especially on windows IO is slow (in comparison to linux based systems).

this PR re-orders conditions to do the IO only at the very last.

@codecov
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

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

Project coverage is 90.08%. Comparing base (81bcbcd) to head (6494815).

Files Patch % Lines
src/Runner/PhptTestCase.php 0.00% 5 Missing ⚠️
src/Util/PHP/AbstractPhpProcess.php 66.66% 1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## 10.5 #5742 +/- ## ============================================ - Coverage 90.08% 90.08% -0.01%  + Complexity 6438 6436 -2  ============================================ Files 680 680 Lines 19534 19532 -2 ============================================ - Hits 17598 17596 -2  Misses 1936 1936 

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

@staabm staabm force-pushed the fileio branch 2 times, most recently from 8a19c56 to 0deae13 Compare March 12, 2024 08:24
@sebastianbergmann sebastianbergmann added type/performance Issues related to resource consumption (time and memory) feature/test-runner CLI test runner version/10 Something affects PHPUnit 10 version/11 Something affects PHPUnit 11 labels Mar 12, 2024
@staabm
Copy link
Contributor Author

staabm commented Mar 12, 2024

should be good to go.

@sebastianbergmann sebastianbergmann merged commit 3299d8c into sebastianbergmann:10.5 Mar 12, 2024
@staabm staabm deleted the fileio branch March 12, 2024 09:48
@Yurunsoft
Copy link

If I use set_error_handler() in my program to catch errors and turn warnings into exceptions, this PR will make it impossible to test.

Message: file_get_contents(/imi/tests/.phpunit.result.cache): Failed to open stream: No such file or directory Location: /imi/vendor/phpunit/phpunit/src/Runner/ResultCache/DefaultResultCache.php:88 

https://github.com/imiphp/imi/actions/runs/8342624739/job/22831196788

@staabm
Copy link
Contributor Author

staabm commented Mar 20, 2024

Sounds like your error handler does not properly detect the @ suppression.

Could you provide more information and a full reproducer (please open a new issue)

@sebastianbergmann
Copy link
Owner

@staabm This was now reported again as #5764. While I do think that this caused by custom error handlers that are too eager and/or interfere with PHPUnit's error handler, I am leaning towards (partially) reverting these changes.

@staabm
Copy link
Contributor Author

staabm commented Mar 21, 2024

@sebastianbergmann let me try to clean this up a bit, so we are more generous in such cases

clxmstaab pushed a commit to staabm/phpunit that referenced this pull request Mar 21, 2024
clxmstaab pushed a commit to staabm/phpunit that referenced this pull request Mar 21, 2024
sebastianbergmann pushed a commit that referenced this pull request Mar 22, 2024
@Yurunsoft
Copy link

This PR fixes my issue: imiphp/imi#683

Use 0 === (error_reporting() & $errno) in set_error_handler

@staabm
Copy link
Contributor Author

staabm commented Mar 23, 2024

@Yurunsoft your PR looks good.

The latest phpunit release relaxed this PRs changes/regressions with #5765

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

Labels

feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory) version/10 Something affects PHPUnit 10 version/11 Something affects PHPUnit 11

3 participants