-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Empty test with runInSeparateProcess fails after test dealing with output buffering #3952
Comments
Does this only happen with |
No. It happens with PHPUnit 7 and PHPUnit 8 stable releases as well. I've updated repository composer.json to use stable PHPUnit 8.4.3. |
Not sure it's related directly with |
Tested more. It seems the following method of rendering a template that is called in one of the tests makes PHPUnit semi-randomly and cryptically fail in the following tests: public function render(): string
{
ob_start();
require __DIR__ . '/template.php';
return ob_get_clean();
} Sometimes it's causing errors like I've posted before, sometimes it's
|
I've looked into it, here is what i've found: if a test method is marked with If you add the annotation i've found a blog post were someone stumbled across a similar problem (https://matthewturland.com/2010/08/19/process-isolation-in-phpunit/) - maybe |
@tomtomsen good finds. Are there any other cases when templates are used? I've since then removed all |
@samdark because of that a template gets generated... yada yada yada. in my opinion you have two options:
To be sure i've tested both and they seem to work fine. |
Added pull-request: yiisoft/yii-web#207 I think this ticket is now resolved. |
Thank you! I've somehow missed it... |
@sebastianbergmann so now we know the reason for the issue in question. For me it's solved thanks to @tomtomsen but I still think that it is quite cryptic behavior. If it cannot be avoided, feel free to close the issue. Thanks. |
Looks to me like this is related to #3954. |
Summary
Empty test with
@runInSeparateProcess
fails if there was a test about output buffering before it.Current behavior
Second empty test errors:
How to reproduce
https://github.com/samdark/phpunit_runInSeparateProcess_bug
composer install
./vendor/bin/phpunit
Expected behavior
No failure. First test should pass. Second one should be marked as risky.
The text was updated successfully, but these errors were encountered: