Skip to content

Commit d913c6f

Browse files
authored
Merge pull request #67 from martinschroeder/signal-constants
StreamSelectLoop: Test suite uses signal constant names in data provider
2 parents d6e47c5 + 72a3d7c commit d913c6f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/StreamSelectLoopTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function testStreamSelectTimeoutEmulation()
4040
public function signalProvider()
4141
{
4242
return [
43-
['SIGUSR1', SIGUSR1],
44-
['SIGHUP', SIGHUP],
45-
['SIGTERM', SIGTERM],
43+
['SIGUSR1'],
44+
['SIGHUP'],
45+
['SIGTERM'],
4646
];
4747
}
4848

@@ -52,7 +52,7 @@ public function signalProvider()
5252
* Test signal interrupt when no stream is attached to the loop
5353
* @dataProvider signalProvider
5454
*/
55-
public function testSignalInterruptNoStream($sigName, $signal)
55+
public function testSignalInterruptNoStream($signal)
5656
{
5757
if (!extension_loaded('pcntl')) {
5858
$this->markTestSkipped('"pcntl" extension is required to run this test.');
@@ -78,7 +78,7 @@ public function testSignalInterruptNoStream($sigName, $signal)
7878
* Test signal interrupt when a stream is attached to the loop
7979
* @dataProvider signalProvider
8080
*/
81-
public function testSignalInterruptWithStream($sigName, $signal)
81+
public function testSignalInterruptWithStream($signal)
8282
{
8383
if (!extension_loaded('pcntl')) {
8484
$this->markTestSkipped('"pcntl" extension is required to run this test.');
@@ -116,7 +116,7 @@ public function testSignalInterruptWithStream($sigName, $signal)
116116
protected function setUpSignalHandler($signal)
117117
{
118118
$this->_signalHandled = false;
119-
$this->assertTrue(pcntl_signal($signal, function() { $this->_signalHandled = true; }));
119+
$this->assertTrue(pcntl_signal(constant($signal), function() { $this->_signalHandled = true; }));
120120
}
121121

122122
/**
@@ -125,7 +125,7 @@ protected function setUpSignalHandler($signal)
125125
protected function resetSignalHandlers()
126126
{
127127
foreach($this->signalProvider() as $signal) {
128-
pcntl_signal($signal[1], SIG_DFL);
128+
pcntl_signal(constant($signal[0]), SIG_DFL);
129129
}
130130
}
131131

@@ -141,7 +141,7 @@ protected function forkSendSignal($signal)
141141
} else if ($childPid === 0) {
142142
// this is executed in the child process
143143
usleep(20000);
144-
posix_kill($currentPid, $signal);
144+
posix_kill($currentPid, constant($signal));
145145
die();
146146
}
147147
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy