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

28 lines
561 B
PHP
Raw Normal View History

2016-12-30 02:16:04 +01:00
<?php
2016-08-23 23:47:40 +02:00
namespace Amp\Parallel\Test\Forking;
2016-08-18 18:04:48 +02:00
2016-08-23 23:47:40 +02:00
use Amp\Parallel\Forking\Fork;
use Amp\Parallel\Test\AbstractContextTest;
use Amp\Loop;
/**
* @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() {
Loop::run(function () {
$fork = Fork::spawn(function () {
usleep(100);
});
2016-08-19 00:36:58 +02:00
return yield $fork->join();
});
}
}