8000 [Process] Don't use @requires on abstract class · symfony/symfony@23fc32f · GitHub
[go: up one dir, main page]

Skip to content

Commit 23fc32f

Browse files
[Process] Don't use @requires on abstract class
1 parent 4c431d6 commit 23fc32f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ public function testFloatAndNullTimeout()
7171
$this->assertNull($p->getTimeout());
7272
}
7373

74-
/**
75-
* @requires extension pcntl
76-
*/
7774
public function testStopWithTimeoutIsActuallyWorking()
7875
{
76+
if (!extension_loaded('pcntl')) {
77+
$this->markTestSkipped('Extension pcntl is required.');
78+
}
79+
7980
// exec is mandatory here since we send a signal to the process
8081
// see https://github.com/symfony/symfony/issues/5030 about prepending
8182
// command with exec
@@ -624,11 +625,12 @@ public function testProcessWithTermSignal()
624625
$this->assertEquals($termSignal, $process->getTermSignal());
625626
}
626627

627-
/**
628-
* @requires function posix_kill
629-
*/
630628
public function testProcessThrowsExceptionWhenExternallySignaled()
631629
{
630+
if (!function_exists('posix_kill')) {
631+
$this->markTestSkipped('Function posix_kill is required.');
632+
}
633+
632634
$termSignal = defined(' 8000 ;SIGKILL') ? SIGKILL : 9;
633635

634636
$process = $this->getProcess('exec php -r "while (true) {}"');
@@ -764,11 +766,12 @@ public function testGetPidIsNullAfterRun()
764766
$this->assertNull($process->getPid());
765767
}
766768

767-
/**
768-
* @requires extension pcntl
769-
*/
770769
public function testSignal()
771770
{
771+
if (!extension_loaded('pcntl')) {
772+
$this->markTestSkipped('Extension pcntl is required.');
773+
}
774+
772775
$process = $this->getProcess('exec php -f '.__DIR__.'/SignalListener.php');
773776
$process->start();
774777
usleep(500000);
@@ -781,11 +784,12 @@ public function testSignal()
781784
$this->assertEquals('Caught SIGUSR1', $process->getOutput());
782785
}
783786

784-
/**
785-
* @requires extension pcntl
786-
*/
787787
public function testExitCodeIsAvailableAfterSignal()
788788
{
789+
if (!extension_loaded('pcntl')) {
790+
$this->markTestSkipped('Extension pcntl is required.');
791+
}
792+
789793
$process = $this->getProcess('sleep 4');
790794
$process->start();
791795
$process->signal(SIGKILL);
@@ -802,10 +806,13 @@ public function testExitCodeIsAvailableAfterSignal()
802806

803807
/**
804808
* @expectedException \Symfony\Component\Process\Exception\LogicException
805-
* @requires extension pcntl
806809
*/
807810
public function testSignalProcessNotRunning()
808811
{
812+
if (!extension_loaded('pcntl')) {
813+
$this->markTestSkipped('Extension pcntl is required.');
814+
}
815+
809816
$process = $this->getProcess(self::$phpBin.' -v');
810817
$process->signal(SIGHUP);
811818
}

src/Symfony/Component/Process/Tests/SimpleProcessTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ public function testExitCodeIsAvailableAfterSignal()
121121
parent::testExitCodeIsAvailableAfterSignal();
122122
}
123123

124+
/**
125+
* @expectedException \Symfony\Component\Process\Exception\LogicException
126+
* @expectedExceptionMessage Can not send signal on a non running process.
127+
*/
124128
public function testSignalProcessNotRunning()
125129
{
126-
$this->setExpectedException('Symfony\Component\Process\Exception\LogicException', 'Can not send signal on a non running process.');
127130
parent::testSignalProcessNotRunning();
128131
}
129132

0 commit comments

Comments
 (0)
0