SigchildDisabledProcessTest.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. You must use setEnhanceSigchildCompatibility() to use this method.
  48. */
  49. public function testMustRun()
  50. {
  51. parent::testMustRun();
  52. }
  53. /**
  54. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  55. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  56. */
  57. public function testSuccessfulMustRunHasCorrectExitCode()
  58. {
  59. parent::testSuccessfulMustRunHasCorrectExitCode();
  60. }
  61. /**
  62. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  63. */
  64. public function testMustRunThrowsException()
  65. {
  66. parent::testMustRunThrowsException();
  67. }
  68. /**
  69. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  70. */
  71. public function testProcessIsSignaledIfStopped()
  72. {
  73. parent::testProcessIsSignaledIfStopped();
  74. }
  75. /**
  76. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  77. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  78. */
  79. public function testProcessWithTermSignal()
  80. {
  81. parent::testProcessWithTermSignal();
  82. }
  83. /**
  84. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  85. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  86. */
  87. public function testProcessIsNotSignaled()
  88. {
  89. parent::testProcessIsNotSignaled();
  90. }
  91. /**
  92. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  93. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  94. */
  95. public function testProcessWithoutTermSignal()
  96. {
  97. parent::testProcessWithoutTermSignal();
  98. }
  99. /**
  100. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  101. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  102. */
  103. public function testCheckTimeoutOnStartedProcess()
  104. {
  105. parent::testCheckTimeoutOnStartedProcess();
  106. }
  107. /**
  108. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  109. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  110. */
  111. public function testGetPid()
  112. {
  113. parent::testGetPid();
  114. }
  115. /**
  116. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  117. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  118. */
  119. public function testGetPidIsNullBeforeStart()
  120. {
  121. parent::testGetPidIsNullBeforeStart();
  122. }
  123. /**
  124. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  125. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  126. */
  127. public function testGetPidIsNullAfterRun()
  128. {
  129. parent::testGetPidIsNullAfterRun();
  130. }
  131. /**
  132. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  133. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  134. */
  135. public function testExitCodeText()
  136. {
  137. $process = $this->getProcess('qdfsmfkqsdfmqmsd');
  138. $process->run();
  139. $process->getExitCodeText();
  140. }
  141. /**
  142. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  143. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  144. */
  145. public function testExitCodeTextIsNullWhenExitCodeIsNull()
  146. {
  147. parent::testExitCodeTextIsNullWhenExitCodeIsNull();
  148. }
  149. /**
  150. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  151. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  152. */
  153. public function testIsSuccessful()
  154. {
  155. parent::testIsSuccessful();
  156. }
  157. /**
  158. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  159. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  160. */
  161. public function testIsSuccessfulOnlyAfterTerminated()
  162. {
  163. parent::testIsSuccessfulOnlyAfterTerminated();
  164. }
  165. /**
  166. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  167. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  168. */
  169. public function testIsNotSuccessful()
  170. {
  171. parent::testIsNotSuccessful();
  172. }
  173. /**
  174. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  175. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
  176. */
  177. public function testTTYCommandExitCode()
  178. {
  179. parent::testTTYCommandExitCode();
  180. }
  181. /**
  182. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  183. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process can not be signaled.
  184. */
  185. public function testSignal()
  186. {
  187. parent::testSignal();
  188. }
  189. /**
  190. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  191. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  192. */
  193. public function testProcessWithoutTermSignalIsNotSignaled()
  194. {
  195. parent::testProcessWithoutTermSignalIsNotSignaled();
  196. }
  197. public function testStopWithTimeoutIsActuallyWorking()
  198. {
  199. $this->markTestSkipped('Stopping with signal is not supported in sigchild environment');
  200. }
  201. public function testProcessThrowsExceptionWhenExternallySignaled()
  202. {
  203. $this->markTestSkipped('Retrieving Pid is not supported in sigchild environment');
  204. }
  205. public function testExitCodeIsAvailableAfterSignal()
  206. {
  207. $this->markTestSkipped('Signal is not supported in sigchild environment');
  208. }
  209. public function testRunProcessWithTimeout()
  210. {
  211. $this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
  212. }
  213. public function provideStartMethods()
  214. {
  215. return array(
  216. array('start', 'Symfony\Component\Process\Exception\LogicException', 'Output has been disabled, enable it to allow the use of a callback.'),
  217. array('run', 'Symfony\Component\Process\Exception\LogicException', 'Output has been disabled, enable it to allow the use of a callback.'),
  218. array('mustRun', 'Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'),
  219. );
  220. }
  221. /**
  222. * {@inheritdoc}
  223. */
  224. protected function getProcess($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  225. {
  226. $process = new ProcessInSigchildEnvironment($commandline, $cwd, $env, $input, $timeout, $options);
  227. $process->setEnhanceSigchildCompatibility(false);
  228. return $process;
  229. }
  230. }