mirror of
https://github.com/danog/parallel.git
synced 2024-12-11 16:49:51 +01:00
36 lines
867 B
PHP
36 lines
867 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Test\Worker;
|
|
|
|
use Amp\Parallel\Worker\DefaultWorkerFactory;
|
|
use Amp\Parallel\Worker\Worker;
|
|
use Amp\PHPUnit\TestCase;
|
|
|
|
class DefaultWorkerFactoryTest extends TestCase
|
|
{
|
|
/**
|
|
* @expectedException \Error
|
|
* @expectedExceptionMessage Invalid environment class name 'Invalid'
|
|
*/
|
|
public function testInvalidClassName()
|
|
{
|
|
$factory = new DefaultWorkerFactory("Invalid");
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Error
|
|
* @expectedExceptionMessage does not implement 'Amp\Parallel\Worker\Environment'
|
|
*/
|
|
public function testNonEnvironmentClassName()
|
|
{
|
|
$factory = new DefaultWorkerFactory(DefaultWorkerFactory::class);
|
|
}
|
|
|
|
public function testCreate()
|
|
{
|
|
$factory = new DefaultWorkerFactory;
|
|
|
|
$this->assertInstanceOf(Worker::class, $factory->create());
|
|
}
|
|
}
|