recca0120/async-testing
A Laravel/PHP testing helper for asynchronous code. recca0120/async-testing offers utilities to write and run tests around async flows, making it easier to validate non-blocking behavior and keep async test suites readable and reliable.
composer require --dev recca0120/async-testing. It is a test-time tool; nothing should ship in production.composer.json (bin, scripts, autoload-dev), then src/ for the console command or runner class. Five minutes in src/ will tell you the exact invocation far faster than guessing. Also skim the package's own tests/ directory — its self-tests are the most reliable usage example.php artisan test --parallel (Paratest) and as a wrapper around PHPUnit process spawning. Check the README for whether it is a runner binary, an artisan command, or a TestCase base class you extend — the integration path differs completely for each.vendor/bin/phpunit. That baseline tells you whether process boot overhead is worth it for your suite size."recca0120/async-testing": "x.y.*"). The last release is 2024-05-03, so verify compatibility against your Laravel and PHPUnit majors before wiring it into CI — PHPUnit 10/11 rewrote large parts of the runner API, and older parallel runners break silently there.DB_DATABASE=test_${worker} derived from the worker index/token the runner exposes) or run migrations plus seeding per worker and tear down afterwards. Never let two workers share a schema.CACHE_DRIVER=array, QUEUE_CONNECTION=sync, MAIL_MAILER=array, SESSION_DRIVER=array, BROADCAST_DRIVER=null. Anything that touches a real network service will collide under parallelism.set -o pipefail if you tee output). Write per-worker logs to storage/logs/ so failures are readable rather than interleaved.--coverage-php per worker and merge with phpcov merge, rather than expecting a single clover file to be correct.setUp across suites — this is also where you centralize the per-worker DB and env bootstrapping so the parallelism stays invisible to individual tests."test:parallel": "...") so the runner's flags and worker count live in one place instead of in every developer's shell history or CI YAML.storage/framework/{cache,sessions,views}, compiled Blade views, and log files are shared by default. Give each worker its own subdirectory keyed by worker index, or you'll get inexplicable cache and view errors that vanish on a serial re-run.:memory: does not work across processes. Each worker gets its own empty in-memory DB. Use a file-based SQLite database per worker, or a real server (MySQL/Postgres) with per-worker schemas.migrate:fresh while another is mid-test. Parallel migration is a common source of deadlocks and flaky "table already exists" errors — migrate once up front, then fan out.config:cache is a trap. A cached config file freezes env values, so per-worker overrides silently do nothing. Clear config before parallel runs, or avoid caching in test environments entirely.--filter on a single process first. If it passes, bisect by running with a fixed seed and reduced worker count (-j1, then -j2). The point at which it breaks tells you whether it's a DB, filesystem, or port problem.phpunit.xml <env> entries, .env.testing, and the runner's per-worker environment all compete. Know which wins in your setup — put worker-specific values in the layer that overrides last, and assert it with a one-off dd(env(...)) rather than assuming.php artisan test --parallel or serial PHPUnit with a one-line script change, and check the issue tracker for your PHPUnit version before adopting.How can I help you explore Laravel packages today?