1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-13 09:37:26 +01:00
parallel/test/Forking/ForkTest.php
2017-03-21 23:19:15 -05:00

30 lines
613 B
PHP

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