1
0
mirror of https://github.com/danog/amp.git synced 2024-12-13 01:47:33 +01:00
amp/test/FailureTest.php
2020-10-30 10:36:19 -05:00

27 lines
494 B
PHP

<?php
namespace Amp\Test;
use Amp\Failure;
use Amp\PHPUnit\AsyncTestCase;
use function Amp\await;
class FailureTest extends AsyncTestCase
{
public function testOnResolve(): void
{
$exception = new \Exception;
$failure = new Failure($exception);
try {
await($failure);
} catch (\Exception $reason) {
$this->assertSame($exception, $reason);
return;
}
$this->fail("Promise was not failed");
}
}