1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00
amp/test/AsyncCoroutineTest.php
2017-05-02 19:04:25 +02:00

23 lines
442 B
PHP

<?php
namespace Amp\Test;
use Amp;
use Amp\Failure;
use Amp\Loop;
use PHPUnit\Framework\TestCase;
class AsyncCoroutineTest extends TestCase {
public function testWithFailure() {
$coroutine = Amp\asyncCoroutine(function ($value) {
return new Failure(new Amp\PHPUnit\TestException);
});
$coroutine(42);
$this->expectException(Amp\PHPUnit\TestException::class);
Loop::run();
}
}