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

Phpunit Util Laravel Package

amphp/phpunit-util

Small utility for simplifying async testing in PHPUnit with AMPHP’s fiber-based concurrency. Integrates seamlessly with AsyncTestCase to run tests as coroutines, ensuring smooth execution of I/O-bound operations like sockets, streams, and HTTP requests. Works with PHP 8.1+. Ideal for testing concurr...

View on GitHub
Deep Wiki
Context7
v2.0.1

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/phpunit-util/compare/v2.0.0...v2.0.1

v3.0.0

This package has been redesigned for compatibility with AMPHP v3 and fibers. AsyncTestCase serves a similar purpose as before, providing helper methods for unit testing within an async context. Each test case is run within a unique fiber to allow suspending during the test run.

  • AsyncTestCase::setUpAsync() and tearDownAsync() have been removed. Use AsyncTestCase::setUp() and tearDown() instead, as both of these methods are now able to execute async using fibers.
  • AsyncTestCase::createCallback() now returns a Closure. Additionally, an optional parameter for expected arguments upon invocation have been added (uses InvocationMocker::with(...) to set expected arguments).
v3.0.0-beta.4
  • Add compatibility with Revolt v1.x
  • Require PHP 8.1
v3.0.0-beta.3
  • Replace deprecated Amp\Future\all with Amp\Future\await
v3.0.0-beta.2

Note: This is a pre-release, there might be breaking changes in the final stable version.

  • Add compatibility with revolt/event-loop v0.2.x
v3.0.0-beta.1

Note: This is a pre-release, there might be breaking changes in the final stable version.

This package has been redesigned for compatibility with amphp v3 and fibers. AsyncTestCase serves a similar purpose as before, providing helper methods for unit testing within an async context. Each test case is run within a unique fiber to allow suspending during the test run.

  • AsyncTestCase::setUpAsync() and tearDownAsync() have been removed. Use AsyncTestCase::setUp() and tearDown() instead, as both of these methods are now able to execute async using fibers.
  • AsyncTestCase::createCallback() now returns a Closure. Additionally, an optional parameter for expected arguments upon invocation have been added (uses InvocationMocker::with(...) to set expected arguments).
v2.0.0

This version is mostly backwards compatible with v1.x, except if a test throws an exception but the loop continues to run, the loop is now stopped after 1 second and the test fails. (#9)

  • PHP 7.1+ required.
  • Calling AsyncTestCase::setTimeout() multiple times will override the previous timeout set.
  • Deprecated functionality has been removed (TestCase and LoopReset removed).
v1.4.0
  • Added setUpAsync() and tearDownAsync() to AsyncTestCase. These methods are executed before and after the test, similar to setUp() and tearDown().
    • Similar to the test case, these methods are executed using Amp\call(), so they may be a regular function, return a promise, or return a generator to be run as a coroutine.
    • setUpAsync() is run after setUp() and must resolve before the test method is executed.
    • tearDownAsync() is run immediately after the test concludes (or times out) and must resolve before tearDown() is run.
  • If a test times out, the test error message now provides, if available, the line in the generator returned by the test method where the timeout was reached.
v1.3.0
  • Added support for PHPUnit 9.
v1.2.0
v1.1.2
  • Fixed an issue where a test method returning a promise or coroutine that did not resolve would result in a passing test. Unresolved promises or coroutines will now result in a failed test.
v1.1.1
  • Fixed exceptions throw from nested calls to Amp\Loop::run().
  • Only setting a minimum runtime in a test will no longer result in a warning about the test performing no assertions.
v1.1.0
  • Added AsyncTestCase as replacement for TestCase + LoopReset
  • Added compatibility with PHPUnit 7 & 8 if AsyncTestCase is used
  • Deprecated TestCase
  • Deprecated LoopReset
v1.0.0

Initial release.

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