mirror of
https://github.com/danog/parallel.git
synced 2024-12-02 09:37:57 +01:00
32 lines
855 B
PHP
32 lines
855 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());
|
||
|
}
|
||
|
}
|