Skip to content

StreamSelectLoop: Test suite uses signal constant names in data provider #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Feb 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/StreamSelectLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function testStreamSelectTimeoutEmulation()
public function signalProvider()
{
return [
['SIGUSR1', SIGUSR1],
['SIGHUP', SIGHUP],
['SIGTERM', SIGTERM],
['SIGUSR1'],
['SIGHUP'],
['SIGTERM'],
];
}

Expand All @@ -52,7 +52,7 @@ public function signalProvider()
* Test signal interrupt when no stream is attached to the loop
* @dataProvider signalProvider
*/
public function testSignalInterruptNoStream($sigName, $signal)
public function testSignalInterruptNoStream($signal)
{
if (!extension_loaded('pcntl')) {
$this->markTestSkipped('"pcntl" extension is required to run this test.');
Expand All @@ -78,7 +78,7 @@ public function testSignalInterruptNoStream($sigName, $signal)
* Test signal interrupt when a stream is attached to the loop
* @dataProvider signalProvider
*/
public function testSignalInterruptWithStream($sigName, $signal)
public function testSignalInterruptWithStream($signal)
{
if (!extension_loaded('pcntl')) {
$this->markTestSkipped('"pcntl" extension is required to run this test.');
Expand Down Expand Up @@ -116,7 +116,7 @@ public function testSignalInterruptWithStream($sigName, $signal)
protected function setUpSignalHandler($signal)
{
$this->_signalHandled = false;
$this->assertTrue(pcntl_signal($signal, function() { $this->_signalHandled = true; }));
$this->assertTrue(pcntl_signal(constant($signal), function() { $this->_signalHandled = true; }));
}

/**
Expand All @@ -125,7 +125,7 @@ protected function setUpSignalHandler($signal)
protected function resetSignalHandlers()
{
foreach($this->signalProvider() as $signal) {
pcntl_signal($signal[1], SIG_DFL);
pcntl_signal(constant($signal[0]), SIG_DFL);
}
}

Expand All @@ -141,7 +141,7 @@ protected function forkSendSignal($signal)
} else if ($childPid === 0) {
// this is executed in the child process
usleep(20000);
posix_kill($currentPid, $signal);
posix_kill($currentPid, constant($signal));
die();
}
}
Expand Down