SigchildDisabledProcessTest.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Process\Tests;
  11. class SigchildDisabledProcessTest extends AbstractProcessTest
  12. {
  13. /**
  14. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  15. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  16. */
  17. public function testGetExitCode()
  18. {
  19. parent::testGetExitCode();
  20. }
  21. /**
  22. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  23. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  24. */
  25. public function testGetExitCodeIsNullOnStart()
  26. {
  27. parent::testGetExitCodeIsNullOnStart();
  28. }
  29. /**
  30. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  31. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  32. */
  33. public function testGetExitCodeIsNullOnWhenStartingAgain()
  34. {
  35. parent::testGetExitCodeIsNullOnWhenStartingAgain();
  36. }
  37. /**
  38. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  39. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  40. */
  41. public function testExitCodeCommandFailed()
  42. {
  43. parent::testExitCodeCommandFailed();
  44. }
  45. /**
  46. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  47. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  48. */
  49. public function testProcessIsSignaledIfStopped()
  50. {
  51. parent::testProcessIsSignaledIfStopped();
  52. }
  53. /**
  54. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  55. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  56. */
  57. public function testProcessWithTermSignal()
  58. {
  59. parent::testProcessWithTermSignal();
  60. }
  61. /**
  62. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  63. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  64. */
  65. public function testProcessIsNotSignaled()
  66. {
  67. parent::testProcessIsNotSignaled();
  68. }
  69. /**
  70. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  71. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  72. */
  73. public function testProcessWithoutTermSignal()
  74. {
  75. parent::testProcessWithoutTermSignal();
  76. }
  77. /**
  78. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  79. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  80. */
  81. public function testCheckTimeoutOnStartedProcess()
  82. {
  83. parent::testCheckTimeoutOnStartedProcess();
  84. }
  85. /**
  86. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  87. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  88. */
  89. public function testGetPid()
  90. {
  91. parent::testGetPid();
  92. }
  93. /**
  94. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  95. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  96. */
  97. public function testGetPidIsNullBeforeStart()
  98. {
  99. parent::testGetPidIsNullBeforeStart();
  100. }
  101. /**
  102. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  103. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  104. */
  105. public function testGetPidIsNullAfterRun()
  106. {
  107. parent::testGetPidIsNullAfterRun();
  108. }
  109. /**
  110. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  111. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  112. */
  113. public function testExitCodeText()
  114. {
  115. $process = $this->getProcess('qdfsmfkqsdfmqmsd');
  116. $process->run();
  117. $process->getExitCodeText();
  118. }
  119. /**
  120. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  121. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  122. */
  123. public function testExitCodeTextIsNullWhenExitCodeIsNull()
  124. {
  125. parent::testExitCodeTextIsNullWhenExitCodeIsNull();
  126. }
  127. /**
  128. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  129. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  130. */
  131. public function testIsSuccessful()
  132. {
  133. parent::testIsSuccessful();
  134. }
  135. /**
  136. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  137. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  138. */
  139. public function testIsSuccessfulOnlyAfterTerminated()
  140. {
  141. parent::testIsSuccessfulOnlyAfterTerminated();
  142. }
  143. /**
  144. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  145. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  146. */
  147. public function testIsNotSuccessful()
  148. {
  149. parent::testIsNotSuccessful();
  150. }
  151. /**
  152. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  153. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  154. */
  155. public function testTTYCommandExitCode()
  156. {
  157. parent::testTTYCommandExitCode();
  158. }
  159. /**
  160. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  161. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process can not be signaled.
  162. */
  163. public function testSignal()
  164. {
  165. parent::testSignal();
  166. }
  167. /**
  168. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  169. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  170. */
  171. public function testProcessWithoutTermSignalIsNotSignaled()
  172. {
  173. parent::testProcessWithoutTermSignalIsNotSignaled();
  174. }
  175. public function testStopWithTimeoutIsActuallyWorking()
  176. {
  177. $this->markTestSkipped('Stopping with signal is not supported in sigchild environment');
  178. }
  179. public function testProcessThrowsExceptionWhenExternallySignaled()
  180. {
  181. $this->markTestSkipped('Retrieving Pid is not supported in sigchild environment');
  182. }
  183. public function testExitCodeIsAvailableAfterSignal()
  184. {
  185. $this->markTestSkipped('Signal is not supported in sigchild environment');
  186. }
  187. public function testRunProcessWithTimeout()
  188. {
  189. $this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
  190. }
  191. /**
  192. * {@inheritdoc}
  193. */
  194. protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array())
  195. {
  196. $process = new ProcessInSigchildEnvironment($commandline, $cwd, $env, $stdin, $timeout, $options);
  197. $process->setEnhanceSigchildCompatibility(false);
  198. return $process;
  199. }
  200. }