amphp / phpunit-util
Helper package to ease testing with PHPUnit.
Fund package maintenance!
amphp
Installs: 79 789
Dependents: 111
Suggesters: 0
Security: 0
Stars: 16
Watchers: 6
Forks: 4
Open Issues: 1
Requires
- php: >=8
- ext-json: *
- amphp/amp: ^3
- phpunit/phpunit: ^9
- revolt/event-loop: ^0.2 || ^0.1
Requires (Dev)
- amphp/php-cs-fixer-config: dev-master
This package is auto-updated.
Last update: 2022-04-28 23:35:08 UTC
README
amphp/phpunit-util
is a small helper package to ease testing with PHPUnit in combination with the Amp
concurrency framework.
Required PHP Version
- PHP 7.1+
Installation
composer require --dev amphp/phpunit-util
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() { $socket = yield Socket\connect('tcp://localhost:12345'); yield $socket->write('foobar'); $this->assertSame('foobar', yield ByteStream\buffer($socket)); } }