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

Async Test Utilities Laravel Package

wyrihaximus/async-test-utilities

Async test utilities for PHP/React tests. Extend AsyncTestCase to run each test inside a Fiber, get random namespaces/directories for filesystem tests, and control per-test or per-class timeouts via the TimeOut attribute (default 30s).

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Async Testing Infrastructure: Enables adoption of asynchronous testing patterns in Laravel/PHP applications, critical for microservices, event-driven architectures, or systems leveraging ReactPHP. Reduces flakiness in tests involving timers, callbacks, or I/O operations.
  • Build vs. Buy: Buy—avoids reinventing async test utilities (e.g., custom event loops, timeouts, or callback tracking). Saves engineering time while maintaining consistency.
  • Roadmap Alignment:
    • Performance Testing: Supports stress-testing async workflows (e.g., queue consumers, WebSocket handlers).
    • CI/CD Optimization: Reduces flaky tests in parallelized CI pipelines by isolating async operations in fibers.
    • Developer Experience: Standardizes async test patterns across teams, lowering onboarding friction.
  • Use Cases:
    • Event-Driven Apps: Testing Laravel queues, ReactPHP event loops, or Pusher/WebSocket integrations.
    • API Rate Limiting: Validating async delays in API responses.
    • Background Jobs: Ensuring job processing adheres to expected timing (e.g., retries, timeouts).

When to Consider This Package

  • Adopt if:
    • Your app uses ReactPHP, Symfony Messenger, or Laravel queues with async operations.
    • Tests frequently fail due to race conditions or timing-sensitive assertions.
    • You need fine-grained control over test timeouts (e.g., 0.3s for fast assertions, 10s for slow I/O).
    • Your team lacks dedicated async testing expertise but needs reliable patterns.
  • Look elsewhere if:
    • Your stack is synchronous-only (e.g., no fibers, event loops, or Promises).
    • You require GUI/integration testing (this is unit/async-focused).
    • Your CI already has built-in async support (e.g., Pest’s async functions) and this adds redundancy.
    • You need mocking frameworks (e.g., Mockery) for async code—this package is for execution, not mocking.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us test async code reliably—critical for our [event-driven/microservices/API] roadmap. It eliminates flaky tests caused by timing issues, saving QA time and reducing CI failures. For example, if we’re scaling our WebSocket service, we can now assert real-time message delivery without race conditions. Low risk (MIT license, minimal overhead), high reward: faster releases and fewer production bugs."

For Engineering:

*"This gives us first-class async test support in PHP:

  • Fiber-based isolation: Tests run in parallel without interference.
  • Custom timeouts: Set per-test or per-class (e.g., [#TimeOut(5)] for slow DB queries).
  • Callback tracking: Verify async functions fire exactly once or N times.
  • Zero reinvention: Built on ReactPHP/PHPUnit—no need to maintain custom solutions. Use case: If we’re adding a new queue worker, this lets us assert job processing order or timeout handling without flakiness."*

Trade-offs:

  • Pros: Faster async test development, fewer CI failures, aligns with modern PHP async stacks.
  • Cons: Requires ReactPHP (but Laravel already uses it for queues/HTTP clients). Minimal learning curve if familiar with PHPUnit.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport