Skip to content

amphp/phpunit-util

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

phpunit-util

License

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