@@ -71,11 +71,12 @@ public function testFloatAndNullTimeout()
71
71
$ this ->assertNull ($ p ->getTimeout ());
72
72
}
73
73
74
- /**
75
- * @requires extension pcntl
76
- */
77
74
public function testStopWithTimeoutIsActuallyWorking ()
78
75
{
76
+ if (!extension_loaded ('pcntl ' )) {
77
+ $ this ->markTestSkipped ('Extension pcntl is required. ' );
78
+ }
79
+
79
80
// exec is mandatory here since we send a signal to the process
80
81
// see https://github.com/symfony/symfony/issues/5030 about prepending
81
82
// command with exec
@@ -624,11 +625,12 @@ public function testProcessWithTermSignal()
624
625
$ this ->assertEquals ($ termSignal , $ process ->getTermSignal ());
625
626
}
626
627
627
- /**
628
- * @requires function posix_kill
629
- */
630
628
public function testProcessThrowsExceptionWhenExternallySignaled ()
631
629
{
630
+ if (!function_exists ('posix_kill ' )) {
631
+ $ this ->markTestSkipped ('Function posix_kill is required. ' );
632
+ }
633
+
632
634
$ termSignal = defined ('
8000
;SIGKILL ' ) ? SIGKILL : 9 ;
633
635
634
636
$ process = $ this ->getProcess ('exec php -r "while (true) {}" ' );
@@ -764,11 +766,12 @@ public function testGetPidIsNullAfterRun()
764
766
$ this ->assertNull ($ process ->getPid ());
765
767
}
766
768
767
- /**
768
- * @requires extension pcntl
769
- */
770
769
public function testSignal ()
771
770
{
771
+ if (!extension_loaded ('pcntl ' )) {
772
+ $ this ->markTestSkipped ('Extension pcntl is required. ' );
773
+ }
774
+
772
775
$ process = $ this ->getProcess ('exec php -f ' .__DIR__ .'/SignalListener.php ' );
773
776
$ process ->start ();
774
777
usleep (500000 );
@@ -781,11 +784,12 @@ public function testSignal()
781
784
$ this ->assertEquals ('Caught SIGUSR1 ' , $ process ->getOutput ());
782
785
}
783
786
784
- /**
785
- * @requires extension pcntl
786
- */
787
787
public function testExitCodeIsAvailableAfterSignal ()
788
788
{
789
+ if (!extension_loaded ('pcntl ' )) {
790
+ $ this ->markTestSkipped ('Extension pcntl is required. ' );
791
+ }
792
+
789
793
$ process = $ this ->getProcess ('sleep 4 ' );
790
794
$ process ->start ();
791
795
$ process ->signal (SIGKILL );
@@ -802,10 +806,13 @@ public function testExitCodeIsAvailableAfterSignal()
802
806
803
807
/**
804
808
* @expectedException \Symfony\Component\Process\Exception\LogicException
805
- * @requires extension pcntl
806
809
*/
807
810
public function testSignalProcessNotRunning ()
808
811
{
812
+ if (!extension_loaded ('pcntl ' )) {
813
+ $ this ->markTestSkipped ('Extension pcntl is required. ' );
814
+ }
815
+
809
816
$ process = $ this ->getProcess (self ::$ phpBin .' -v ' );
810
817
$ process ->signal (SIGHUP );
811
818
}
0 commit comments