2020-03-01 11:49:22 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Asio;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2020-03-01 21:52:25 +01:00
|
|
|
use Psl\Asio\WrappedException;
|
2020-03-01 11:49:22 +01:00
|
|
|
|
|
|
|
class WrappedExceptionTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testIsSucceeded(): void
|
|
|
|
{
|
|
|
|
$wrapper = new WrappedException(new \Exception('foo'));
|
2020-07-12 16:51:18 +02:00
|
|
|
self::assertFalse($wrapper->isSucceeded());
|
2020-03-01 11:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsFailed(): void
|
|
|
|
{
|
|
|
|
$wrapper = new WrappedException(new \Exception('foo'));
|
2020-07-12 16:51:18 +02:00
|
|
|
self::assertTrue($wrapper->isFailed());
|
2020-03-01 11:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetResult(): void
|
|
|
|
{
|
|
|
|
$exception = new \Exception('bar');
|
|
|
|
$wrapper = new WrappedException($exception);
|
|
|
|
|
|
|
|
$this->expectExceptionObject($exception);
|
|
|
|
$wrapper->getResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetException(): void
|
|
|
|
{
|
|
|
|
$exception = new \Exception('bar');
|
|
|
|
$wrapper = new WrappedException($exception);
|
|
|
|
$e = $wrapper->getException();
|
2020-07-12 16:51:18 +02:00
|
|
|
self::assertSame($exception, $e);
|
2020-03-01 11:49:22 +01:00
|
|
|
}
|
|
|
|
}
|