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...
Full Changelog: https://github.com/amphp/phpunit-util/compare/v2.0.0...v2.0.1
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).Amp\Future\all with Amp\Future\awaitNote: This is a pre-release, there might be breaking changes in the final stable version.
revolt/event-loop v0.2.xNote: 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).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)
AsyncTestCase::setTimeout() multiple times will override the previous timeout set.TestCase and LoopReset removed).setUpAsync() and tearDownAsync() to AsyncTestCase. These methods are executed before and after the test, similar to setUp() and tearDown().
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.TracingDriver::dump() is now included in the failure message on timeouts.Amp\Loop::run().AsyncTestCase as replacement for TestCase + LoopResetAsyncTestCase is usedTestCaseLoopResetInitial release.
How can I help you explore Laravel packages today?