From d40c92e16775427254c5e7e5562ee2db9627592e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 6 May 2025 11:08:27 +0200 Subject: [PATCH 1/2] don't hardcode OS-depending constant values The values of the SIG* constants depend on the OS. --- Tests/SignalRegistry/SignalMapTest.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Tests/SignalRegistry/SignalMapTest.php b/Tests/SignalRegistry/SignalMapTest.php index f4e320477..73619049d 100644 --- a/Tests/SignalRegistry/SignalMapTest.php +++ b/Tests/SignalRegistry/SignalMapTest.php @@ -18,17 +18,21 @@ class SignalMapTest extends TestCase { /** * @requires extension pcntl - * - * @testWith [2, "SIGINT"] - * [9, "SIGKILL"] - * [15, "SIGTERM"] - * [31, "SIGSYS"] + * @dataProvider provideSignals */ public function testSignalExists(int $signal, string $expected) { $this->assertSame($expected, SignalMap::getSignalName($signal)); } + public function provideSignals() + { + yield [\SIGINT, 'SIGINT']; + yield [\SIGKILL, 'SIGKILL']; + yield [\SIGTERM, 'SIGTERM']; + yield [\SIGSYS, 'SIGSYS']; + } + public function testSignalDoesNotExist() { $this->assertNull(SignalMap::getSignalName(999999)); From 7d29659bc3c9d8e9a34e2c3414ef9e9e003e6cf3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 7 May 2025 09:05:04 +0200 Subject: [PATCH 2/2] properly skip signal test if the pcntl extension is not installed --- Tests/SignalRegistry/SignalMapTest.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Tests/SignalRegistry/SignalMapTest.php b/Tests/SignalRegistry/SignalMapTest.php index 73619049d..3a0c49bb0 100644 --- a/Tests/SignalRegistry/SignalMapTest.php +++ b/Tests/SignalRegistry/SignalMapTest.php @@ -18,19 +18,13 @@ class SignalMapTest extends TestCase { /** * @requires extension pcntl - * @dataProvider provideSignals */ - public function testSignalExists(int $signal, string $expected) + public function testSignalExists() { - $this->assertSame($expected, SignalMap::getSignalName($signal)); - } - - public function provideSignals() - { - yield [\SIGINT, 'SIGINT']; - yield [\SIGKILL, 'SIGKILL']; - yield [\SIGTERM, 'SIGTERM']; - yield [\SIGSYS, 'SIGSYS']; + $this->assertSame('SIGINT', SignalMap::getSignalName(\SIGINT)); + $this->assertSame('SIGKILL', SignalMap::getSignalName(\SIGKILL)); + $this->assertSame('SIGTERM', SignalMap::getSignalName(\SIGTERM)); + $this->assertSame('SIGSYS', SignalMap::getSignalName(\SIGSYS)); } public function testSignalDoesNotExist()