public function testShutdownHandlerWasCalledOnSigTerm() { $process = $this->manager->fork(function (Process $p) { $sm = $p->getSharedMemory(); $m = new ProcessManager(); $m->onShutdown(function () use(&$sm) { $sm['wasCalled'] = true; })->fork(function () { usleep(300000); }); $sm['ready'] = true; $m->wait(); }); $this->waitReady($process); $process->kill(); $this->manager->wait(); $sm = $process->getSharedMemory(); $this->assertTrue($sm['wasCalled']); }