1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 10:07:49 +01:00
parallel/test/Worker/DefaultWorkerFactoryTest.php

36 lines
867 B
PHP
Raw Normal View History

2017-12-14 06:06:38 +01:00
<?php
namespace Amp\Parallel\Test\Worker;
use Amp\Parallel\Worker\DefaultWorkerFactory;
use Amp\Parallel\Worker\Worker;
use Amp\PHPUnit\TestCase;
2018-10-07 16:50:45 +02:00
class DefaultWorkerFactoryTest extends TestCase
{
2017-12-14 06:06:38 +01:00
/**
* @expectedException \Error
* @expectedExceptionMessage Invalid environment class name 'Invalid'
*/
2018-10-07 16:50:45 +02:00
public function testInvalidClassName()
{
2017-12-14 06:06:38 +01:00
$factory = new DefaultWorkerFactory("Invalid");
}
/**
* @expectedException \Error
* @expectedExceptionMessage does not implement 'Amp\Parallel\Worker\Environment'
*/
2018-10-07 16:50:45 +02:00
public function testNonEnvironmentClassName()
{
2017-12-14 06:06:38 +01:00
$factory = new DefaultWorkerFactory(DefaultWorkerFactory::class);
}
2018-10-07 16:50:45 +02:00
public function testCreate()
{
2017-12-14 06:06:38 +01:00
$factory = new DefaultWorkerFactory;
$this->assertInstanceOf(Worker::class, $factory->create());
}
}