mirror of
https://github.com/danog/parallel.git
synced 2024-12-11 16:49:51 +01:00
28 lines
585 B
PHP
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();
|
|
}));
|
|
}
|
|
}
|