1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-12 17:17:20 +01:00
parallel/test/Forking/ForkTest.php
Aaron Piotrowski da84a772cf Port to Amp
2016-08-18 11:04:48 -05:00

34 lines
637 B
PHP

<?php
namespace Amp\Tests\Concurrent\Forking;
use Amp\Concurrent\Forking\Fork;
use Amp\Coroutine;
use Amp\Loop;
use Amp\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);
});
return yield from $fork->join();
})->done();
Loop\run();
}
}