1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-12 17:17:20 +01:00
parallel/test/Forking/ForkTest.php
2016-12-29 19:16:04 -06:00

27 lines
550 B
PHP

<?php
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();
});
}
}