Releases: amphp/phpunit-util
2.0.1
3.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()
andtearDownAsync()
have been removed. UseAsyncTestCase::setUp()
andtearDown()
instead, as both of these methods are now able to execute async using fibers.AsyncTestCase::createCallback()
now returns aClosure
. Additionally, an optional parameter for expected arguments upon invocation have been added (usesInvocationMocker::with(...)
to set expected arguments).
3.0.0 Beta 4
- Add compatibility with Revolt v1.x
- Require PHP 8.1
3.0.0 Beta 3
- Replace deprecated
Amp\Future\all
withAmp\Future\await
3.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
3.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()
andtearDownAsync()
have been removed. UseAsyncTestCase::setUp()
andtearDown()
instead, as both of these methods are now able to execute async using fibers.AsyncTestCase::createCallback()
now returns aClosure
. Additionally, an optional parameter for expected arguments upon invocation have been added (usesInvocationMocker::with(...)
to set expected arguments).
2.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
andLoopReset
removed).
1.4.0
- Added
setUpAsync()
andtearDownAsync()
toAsyncTestCase
. These methods are executed before and after the test, similar tosetUp()
andtearDown()
.- 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 aftersetUp()
and must resolve before the test method is executed.tearDownAsync()
is run immediately after the test concludes (or times out) and must resolve beforetearDown()
is run.
- Similar to the test case, these methods are executed using
- 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.
1.3.0
1.2.0
- Information from
TracingDriver::dump()
is now included in the failure message on timeouts.