1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00
amp/test/RethrowTest.php
2016-11-14 13:59:21 -06:00

27 lines
631 B
PHP

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