1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-13 17:47:32 +01:00
parallel/tests/Forking/ForkTest.php

33 lines
651 B
PHP
Raw Normal View History

<?php
namespace Icicle\Tests\Concurrent\Forking;
use Icicle\Concurrent\Forking\Fork;
use Icicle\Coroutine;
use Icicle\Loop;
use Icicle\Tests\Concurrent\AbstractContextTest;
/**
* @group forking
* @requires extension pcntl
*/
class ForkTest extends AbstractContextTest
{
public function createContext(callable $function)
{
return new Fork($function);
}
public function testSpawnStartsFork()
{
Coroutine\create(function () {
$fork = Fork::spawn(function () {
usleep(100);
});
2016-01-23 07:00:56 +01:00
return yield from $fork->join();
})->done();
Loop\run();
}
}