mirror of
https://github.com/danog/amp.git
synced 2024-12-11 17:09:40 +01:00
2f778fe069
Removes deprecated APIs.
27 lines
492 B
PHP
27 lines
492 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) {
|
|
self::assertSame($exception, $reason);
|
|
return;
|
|
}
|
|
|
|
self::fail("Promise was not failed");
|
|
}
|
|
}
|