1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-13 09:37:26 +01:00
parallel/test/Forking/ForkTest.php
2016-08-23 16:47:40 -05:00

27 lines
577 B
PHP

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