1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-04 02:27:55 +01:00
parallel/test/Context/DefaultContextFactoryTest.php

29 lines
824 B
PHP
Raw Normal View History

2020-02-15 00:22:41 +01:00
<?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;
2020-02-15 01:31:01 +01:00
class DefaultContextFactoryTest extends AsyncTestCase
2020-02-15 00:22:41 +01:00
{
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();
}
}