public function testWait()
{
$this->process_thread = new MyThread();
$this->process_runable = new \Jenner\SimpleFork\Process(new MyRunnable());
$this->process_callback = new \Jenner\SimpleFork\Process(function () {
for ($i = 0; $i < 3; $i++) {
// echo "callback pid:" . getmypid() . PHP_EOL;
}
});
$this->process_thread->start();
$this->process_thread->wait();
$this->assertEquals(0, $this->process_thread->errno());
$this->assertEquals($this->process_thread->errno(), 0);
$this->assertEquals($this->process_thread->errmsg(), 'Success');
$this->assertEquals($this->process_thread->isRunning(), false);
$this->process_runable->start();
$this->process_runable->wait();
$this->assertEquals(0, $this->process_runable->errno());
$this->process_callback->start();
$this->process_callback->wait();
$this->assertEquals(0, $this->process_callback->errno());
}