mirror of
https://github.com/danog/parallel.git
synced 2024-11-27 04:44:56 +01:00
Fix worker tests to not use kill() so much
This commit is contained in:
parent
3df0194563
commit
3ee7e7ab0d
@ -14,25 +14,32 @@ abstract class AbstractWorkerTest extends TestCase
|
|||||||
|
|
||||||
public function testIsRunning()
|
public function testIsRunning()
|
||||||
{
|
{
|
||||||
$worker = $this->createWorker();
|
Coroutine\create(function () {
|
||||||
$this->assertFalse($worker->isRunning());
|
$worker = $this->createWorker();
|
||||||
|
$this->assertFalse($worker->isRunning());
|
||||||
|
|
||||||
$worker->start();
|
$worker->start();
|
||||||
$this->assertTrue($worker->isRunning());
|
$this->assertTrue($worker->isRunning());
|
||||||
|
|
||||||
$worker->kill();
|
yield $worker->shutdown();
|
||||||
sleep(1);
|
$this->assertFalse($worker->isRunning());
|
||||||
$this->assertFalse($worker->isRunning());
|
})->done();
|
||||||
|
|
||||||
|
Loop\run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsIdleOnStart()
|
public function testIsIdleOnStart()
|
||||||
{
|
{
|
||||||
$worker = $this->createWorker();
|
Coroutine\create(function () {
|
||||||
$worker->start();
|
$worker = $this->createWorker();
|
||||||
|
$worker->start();
|
||||||
|
|
||||||
$this->assertTrue($worker->isIdle());
|
$this->assertTrue($worker->isIdle());
|
||||||
|
|
||||||
$worker->kill();
|
yield $worker->shutdown();
|
||||||
|
})->done();
|
||||||
|
|
||||||
|
Loop\run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEnqueue()
|
public function testEnqueue()
|
||||||
|
Loading…
Reference in New Issue
Block a user