1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-12 09:09:35 +01:00
parallel/test/Forking/ForkTest.php
2017-01-09 11:11:25 -06:00

28 lines
585 B
PHP

<?php
namespace Amp\Parallel\Test\Forking;
use Amp\Parallel\Forking\Fork;
use Amp\Parallel\Test\AbstractContextTest;
use AsyncInterop\Loop;
/**
* @group forking
* @requires extension pcntl
*/
class ForkTest extends AbstractContextTest {
public function createContext(callable $function) {
return new Fork($function);
}
public function testSpawnStartsFork() {
Loop::execute(\Amp\wrap(function () {
$fork = Fork::spawn(function () {
usleep(100);
});
return yield $fork->join();
}));
}
}