1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-30 04:39:01 +01:00
parallel/test/Worker/DefaultWorkerFactoryTest.php
2019-08-27 12:17:41 -05:00

34 lines
896 B
PHP

<?php
namespace Amp\Parallel\Test\Worker;
use Amp\Parallel\Worker\DefaultWorkerFactory;
use Amp\Parallel\Worker\Worker;
use Amp\PHPUnit\AsyncTestCase;
class DefaultWorkerFactoryTest extends AsyncTestCase
{
public function testInvalidClassName()
{
$this->expectException(\Error::class);
$this->expectExceptionMessage("Invalid environment class name 'Invalid'");
$factory = new DefaultWorkerFactory("Invalid");
}
public function testNonEnvironmentClassName()
{
$this->expectException(\Error::class);
$this->expectExceptionMessage("does not implement 'Amp\\Parallel\\Worker\\Environment'");
$factory = new DefaultWorkerFactory(DefaultWorkerFactory::class);
}
public function testCreate()
{
$factory = new DefaultWorkerFactory;
$this->assertInstanceOf(Worker::class, $factory->create());
}
}