1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-04 18:47:50 +01:00
parallel/test/Sync/ExitFailureTest.php

26 lines
662 B
PHP
Raw Normal View History

2017-12-14 06:06:38 +01:00
<?php
namespace Amp\Parallel\Test\Sync;
use Amp\Parallel\Sync\ExitFailure;
use Amp\Parallel\Sync\PanicError;
use Amp\PHPUnit\TestCase;
2018-10-07 16:50:45 +02:00
class ExitFailureTest extends TestCase
{
public function testGetResult()
{
2017-12-14 06:06:38 +01:00
$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));
}
}