1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 10:07:49 +01:00
parallel/test/Context/DefaultContextFactoryTest.php
Aaron Piotrowski 26f869734a
CS Fix
2020-02-14 18:31:01 -06:00

29 lines
824 B
PHP

<?php
namespace Amp\Parallel\Test\Context;
use Amp\Parallel\Context\Context;
use Amp\Parallel\Context\DefaultContextFactory;
use Amp\Parallel\Sync\ContextPanicError;
use Amp\PHPUnit\AsyncTestCase;
class DefaultContextFactoryTest extends AsyncTestCase
{
public function testCreate(): void
{
$factory = new DefaultContextFactory;
$context = $factory->create(__DIR__ . '/Fixtures/test-process.php');
$this->assertInstanceOf(Context::class, $context);
}
public function testRun(): \Generator
{
$this->expectException(ContextPanicError::class);
$this->expectExceptionMessage('No string provided');
$factory = new DefaultContextFactory;
$context = yield $factory->run(__DIR__ . '/Fixtures/test-process.php');
yield $context->join();
}
}