/** * Creates required internal instances. * * Load default signal handlers. */ public function __construct() { $this->info = new Info(); $this->signal = new Signal(); $this->signal->setHandler('child', new SignalChild($this)); $this->signal->setHandler('interrupt', new SignalInterrupt($this)); $this->signal->setHandler('quit', new SignalQuit($this)); $this->signal->setHandler('terminate', new SignalTerminate($this)); }
public function testShouldUseCurrentProcessIdWhenSendingSignalWithoutDefiningProcessId() { $actualProcessId = null; $expectedProcessId = 42; $this->overwrite('posix_getpid', function () use($expectedProcessId) { return $expectedProcessId; }); $this->overwrite('posix_kill', function ($processId) use(&$actualProcessId) { $actualProcessId = $processId; return true; }); $signal = new Signal(); $signal->send('kill'); $this->assertEquals($expectedProcessId, $actualProcessId); }