Initial commit

This commit is contained in:
2018-04-15 16:41:46 +02:00
commit 86ff40274b
29 changed files with 1368 additions and 0 deletions

View File

@ -0,0 +1,42 @@
<?php
namespace NoccyLabs\Ipc\Signal;
class SignalTrapTest extends \PhpUnit\Framework\TestCase
{
public function testSignalTrap()
{
$trap = new SignalTrap(SIGUSR1);
$this->assertEquals(false, $trap->isTrapped());
posix_kill(posix_getpid(), SIGUSR1);
usleep(1000);
$this->assertEquals(true, $trap->isTrapped());
$this->assertEquals(false, $trap->isTrapped());
}
public function testSignalTrapWithoutResetting()
{
$trap = new SignalTrap(SIGUSR1);
$this->assertEquals(false, $trap->isTrapped());
posix_kill(posix_getpid(), SIGUSR1);
usleep(1000);
$this->assertEquals(true, $trap->isTrapped(false));
$this->assertEquals(true, $trap->isTrapped());
}
}