1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 05:11:42 +01:00
amp/test/RethrowTest.php
2016-07-12 11:20:06 -05:00

27 lines
612 B
PHP

<?php
namespace Amp\Test;
use Amp;
use Amp\Failure;
use Interop\Async\Loop;
class RethrowTest extends \PHPUnit_Framework_TestCase {
public function testWaitOnPendingAwaitable() {
$exception = new \Exception;
try {
Loop::execute(function () use ($exception) {
$awaitable = new Failure($exception);
Amp\rethrow($awaitable);
});
} catch (\Exception $reason) {
$this->assertSame($exception, $reason);
return;
}
$this->fail('Failed awaitable reason should be thrown from loop');
}
}