Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

React Phpunit Run Tests In Fiber Laravel Package

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).

View on GitHub
Deep Wiki
Context7
3.0.0

3.0.0

  • Total issues resolved: 0
  • Total pull requests resolved: 5
  • Total contributors: 3

Dependencies 📦,Enhancement ✨

Dependencies 📦

2.0.0
  • PHP8.2+
  • PHPUnit 10+ + added it as a dependency to enforce supported versions

2.0.0

  • Total issues resolved: 0
  • Total pull requests resolved: 7
  • Total contributors: 2

Bug 🐞

Dependencies 📦,Enhancement ✨

Dependencies 📦

Enhancement ✨

1.0.1

1.0.1

  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1

Bug 🐞,Dependencies 📦

1.0.0

Usage

<?php

declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use React\Promise\Promise;
use WyriHaximus\React\PHPUnit\RunTestsInFibersTrait;

use function React\Asyncwait;

final class SomeTest extends TestCase
{
    use RunTestsInFibersTrait;

    /**
     * [@test](https://github.com/test)
     */
    public function happyFlow()
    {
        self::assertTrue(await(new Promise(static function (callable $resolve): void {
            $resolve(true);
        })));
    }
}

Timeouts

This package supports marking a test failed once a timeout has been reached. Note that this doesn't stop anything running in the fiber the rest runs in or cleans up the loop as we cannot kill the running fiber once it starts. An exception is thrown in the scope between the test and PHPUnit that handles running the test in a fiber. And this is out of control of the test.

<?php

declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use React\Promise\Promise;
use WyriHaximus\React\PHPUnit\RunTestsInFibersTrait;
use WyriHaximus\React\PHPUnit\TimeOut;

use function React\Asyncwait;

#[TimeOut(30)]
final class SomeTest extends TestCase
{
    use RunTestsInFibersTrait;

    /**
     * [@test](https://github.com/test)
     */
    #[TimeOut(0.1)]
    public function happyFlow()
    {
        self::assertTrue(await(new Promise(static function (callable $resolve): void {
            $resolve(true);
        })));
    }
}

1.0.0

  • Total issues resolved: 0
  • Total pull requests resolved: 5
  • Total contributors: 2

Bug 🐞,Dependencies 📦

Dependencies 📦

Feature 🏗

Enhancement ✨

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai