amphp / phpunit-util
Helper package to ease testing with PHPUnit.
Fund package maintenance!
amphp
Installs: 446 901
Dependents: 137
Suggesters: 0
Security: 0
Stars: 21
Watchers: 8
Forks: 8
Open Issues: 3
Requires
- php: >=8.1
- amphp/amp: ^3
- phpunit/phpunit: ^9
- revolt/event-loop: ^1 || ^0.2
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-19 06:08:50 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.
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 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)); } }