mirror of
https://github.com/danog/amp.git
synced 2024-12-13 01:47:33 +01:00
27 lines
494 B
PHP
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");
|
|
}
|
|
}
|