amphp / phpunit-util
Helper package to ease testing with PHPUnit.
Fund package maintenance!
v4.0.0-beta.1
2026-10-31 01:07 UTC
Requires
- php: >=8.3
- amphp/amp: ^3
- phpunit/phpunit: ^12 | ^13
- revolt/event-loop: ^1
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-31 18:05:48 UTC
README
AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind.
amphp/phpunit-util is a small helper package to ease testing with PHPUnit.
Installation
This package can be installed as a Composer dependency.
composer require --dev amphp/phpunit-util
The package requires PHP 8.1 or later and PHPUnit 9 or 12+ (PHPUnit 10 and 11 are not supported).
PHP and PHPUnit versions supported
amphp/phpunit-util Version |
PHP | PHPUnit |
|---|---|---|
| 3 | 8.1+ | 9 |
| 4 | 8.3+ | 12+ |
Usage
<?php namespace Foo; use Amp\ByteStream; use Amp\PHPUnit\AsyncTestCase; use Amp\Socket; class BarTest extends AsyncTestCase { // Each test case is executed as a coroutine (within a separate fiber) and checked to run to completion public function test(): void { $socket = Socket\connect('tcp://localhost:12345'); $socket->write('foobar'); $this->assertSame('foobar', ByteStream\buffer($socket)); } }