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

[Bug]: Debug output not working due to phpunit nested output buffering #1354

Open
vuryss opened this issue Feb 11, 2025 · 0 comments
Open

[Bug]: Debug output not working due to phpunit nested output buffering #1354

vuryss opened this issue Feb 11, 2025 · 0 comments
Labels

Comments

@vuryss
Copy link

vuryss commented Feb 11, 2025

What Happened

When I use expect('test')->dd() I expect to see the 'test' dumped, however I get nothing due to PHPUnit opening a second nested output buffering.

I do not have the 'dd' function locally, so it falls back to var_dump + exit. This correctly closes the first output buffering from Pest, however the second output buffering, which was started after it (and consumed all the output) - is not reached, thus closed in incorrect order and output is gone.

How to Reproduce

PHPUnit version: 11.5.3
Just create above simple expect and see.

Sample Repository

No response

Pest Version

3.7.4

PHP Version

8.4.3

Operation System

Linux

Notes

First output buffering start:

KernelDump.php:32, Pest\KernelDump->{closure:/library/vendor/pestphp/pest/src/KernelDump.php:31-35}()
KernelDump.php:43, ob_clean()
KernelDump.php:43, Pest\KernelDump->disable()
EnsureKernelDumpIsFlushed.php:26, Pest\Subscribers\EnsureKernelDumpIsFlushed->notify()
DirectDispatcher.php:106, PHPUnit\Event\DirectDispatcher->dispatch()
DeferringDispatcher.php:47, PHPUnit\Event\DeferringDispatcher->dispatch()
DispatchingEmitter.php:73, PHPUnit\Event\DispatchingEmitter->testRunnerStarted()
TestRunner.php:33, PHPUnit\TextUI\TestRunner->run()
Application.php:210, PHPUnit\TextUI\Application->run()
Kernel.php:103, Pest\Kernel->handle()
pest:184, {closure:/library/vendor/pestphp/pest/bin/pest:18-192}()
pest:192, include()
pest:119, {main}()

Second nested output buffering start:

TestCase.php:1861, PHPUnit\Framework\TestCase->startOutputBuffering()
TestCase.php:484, PHPUnit\Framework\TestCase->runBare()
TestRunner.php:87, PHPUnit\Framework\TestRunner->run()
TestCase.php:361, PHPUnit\Framework\TestCase->run()
TestSuite.php:369, PHPUnit\Framework\TestSuite->run()
TestSuite.php:369, PHPUnit\Framework\TestSuite->run()
TestSuite.php:369, PHPUnit\Framework\TestSuite->run()
TestSuite.php:369, PHPUnit\Framework\TestSuite->run()
TestRunner.php:64, PHPUnit\TextUI\TestRunner->run()
Application.php:210, PHPUnit\TextUI\Application->run()
Kernel.php:103, Pest\Kernel->handle()
pest:184, {closure:/library/vendor/pestphp/pest/bin/pest:18-192}()
pest:192, include()
pest:119, {main}()
@vuryss vuryss added the bug label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant