1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-13 17:47:32 +01:00
parallel/test/Forking/ForkTest.php

27 lines
583 B
PHP
Raw Normal View History

2016-08-22 06:40:48 +02:00
<?php declare(strict_types = 1);
2016-08-19 00:36:58 +02:00
namespace Amp\Concurrent\Test\Forking;
2016-08-18 18:04:48 +02:00
use Amp\Concurrent\Forking\Fork;
2016-08-19 00:36:58 +02:00
use Amp\Concurrent\Test\AbstractContextTest;
/**
* @group forking
* @requires extension pcntl
*/
2016-08-19 00:36:58 +02:00
class ForkTest extends AbstractContextTest {
public function createContext(callable $function) {
return new Fork($function);
}
2016-08-19 00:36:58 +02:00
public function testSpawnStartsFork() {
\Amp\execute(function () {
$fork = Fork::spawn(function () {
usleep(100);
});
2016-08-19 00:36:58 +02:00
return yield $fork->join();
});
}
}