amphp/phpunit-util

Helper package to ease testing with PHPUnit.

Package info

github.com/amphp/phpunit-util

Homepage

pkg:composer/amphp/phpunit-util

Fund package maintenance!

amphp

Statistics

Installs: 787 161

Dependents: 140

Suggesters: 0

Stars: 22

Open Issues: 2

v3.0.0 2022-12-18 17:47 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 14d1c36ec0c72fe76b301a17af1d52330cc61d0c

  • Niklas Keller <me.woop@kelunik.com>
  • Aaron Piotrowski <aaron.woop@trowski.com>

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.

👁 License

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));
 }
}