mirror of
https://github.com/danog/parallel.git
synced 2024-12-02 09:37:57 +01:00
26 lines
672 B
PHP
26 lines
672 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Test\Sync;
|
|
|
|
use Amp\Parallel\Sync\ExitFailure;
|
|
use Amp\Parallel\Sync\PanicError;
|
|
use Amp\PHPUnit\AsyncTestCase;
|
|
|
|
class ExitFailureTest extends AsyncTestCase
|
|
{
|
|
public function testGetResult()
|
|
{
|
|
$message = "Test message";
|
|
$exception = new \Exception($message);
|
|
$result = new ExitFailure($exception);
|
|
try {
|
|
$result->getResult();
|
|
} catch (PanicError $caught) {
|
|
$this->assertGreaterThan(0, \stripos($caught->getMessage(), $message));
|
|
return;
|
|
}
|
|
|
|
$this->fail(\sprintf("Exception should be thrown from %s::getResult()", ExitFailure::class));
|
|
}
|
|
}
|