wyrihaximus/react-phpunit-run-tests-in-fiber
PHPUnit trait to run each test inside a PHP Fiber, making it easy to use ReactPHP async/await in tests. Includes optional per-test or per-class timeout attributes to fail slow tests (without stopping the running fiber).
Architecture fit: This package is a poor fit for standard Laravel applications due to its reliance on ReactPHP fibers, which are incompatible with Laravel’s synchronous testing framework and async tools (e.g., queues, Guzzle HTTP clients). It is only viable for projects explicitly using ReactPHP’s event loop (e.g., custom async services, non-blocking I/O). For Laravel, this would require a custom integration layer to bridge fibers with Laravel’s test lifecycle (e.g., database transactions, service providers).
Integration feasibility: Low for most Laravel use cases. The package assumes a ReactPHP-centric environment, while Laravel’s default stack (Symfony components, queues, HTTP clients) operates outside fibers. Integration would require:
TestCase::setUp()).react/async may clash with Laravel’s native async tools (e.g., spatie/async or laravel-horizon).Technical risk:
Key questions:
Stack fit:
await() is required in tests.spatie/async.Migration path:
composer.json under require-dev.AsyncServiceTest).PHPUnit\Framework\TestCase to initialize the ReactPHP loop in setUp().use React\EventLoop\Factory;
use WyriHaximus\React\PHPUnit\RunTestsInFibersTrait;
abstract class AsyncTestCase extends TestCase
{
use RunTestsInFibersTrait;
protected function setUp(): void
{
$this->loop = Factory::create();
parent::setUp();
}
protected function tearDown(): void
{
$this->loop->stop();
parent::tearDown();
}
}
--group async in PHPUnit to separate them from synchronous tests.Compatibility:
react/async version (if used).Maintenance:
Support:
Scaling:
Failure modes:
Ramp-up:
How can I help you explore Laravel packages today?