SigchildEnabledProcessTest.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 SigchildEnabledProcessTest extends AbstractProcessTest
  12. {
  13. /**
  14. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  15. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  16. */
  17. public function testProcessIsSignaledIfStopped()
  18. {
  19. parent::testProcessIsSignaledIfStopped();
  20. }
  21. /**
  22. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  23. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  24. */
  25. public function testProcessWithTermSignal()
  26. {
  27. parent::testProcessWithTermSignal();
  28. }
  29. /**
  30. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  31. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  32. */
  33. public function testProcessIsNotSignaled()
  34. {
  35. parent::testProcessIsNotSignaled();
  36. }
  37. /**
  38. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  39. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
  40. */
  41. public function testProcessWithoutTermSignal()
  42. {
  43. parent::testProcessWithoutTermSignal();
  44. }
  45. /**
  46. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  47. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  48. */
  49. public function testGetPid()
  50. {
  51. parent::testGetPid();
  52. }
  53. /**
  54. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  55. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  56. */
  57. public function testGetPidIsNullBeforeStart()
  58. {
  59. parent::testGetPidIsNullBeforeStart();
  60. }
  61. /**
  62. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  63. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
  64. */
  65. public function testGetPidIsNullAfterRun()
  66. {
  67. parent::testGetPidIsNullAfterRun();
  68. }
  69. public function testExitCodeText()
  70. {
  71. $process = $this->getProcess('qdfsmfkqsdfmqmsd');
  72. $process->run();
  73. $this->assertInternalType('string', $process->getExitCodeText());
  74. }
  75. /**
  76. * @expectedException \Symfony\Component\Process\Exception\RuntimeException
  77. * @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process can not be signaled.
  78. */
  79. public function testSignal()
  80. {
  81. parent::testSignal();
  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 testProcessWithoutTermSignalIsNotSignaled()
  88. {
  89. parent::testProcessWithoutTermSignalIsNotSignaled();
  90. }
  91. public function testProcessThrowsExceptionWhenExternallySignaled()
  92. {
  93. $this->markTestSkipped('Retrieving Pid is not supported in sigchild environment');
  94. }
  95. public function testExitCodeIsAvailableAfterSignal()
  96. {
  97. $this->markTestSkipped('Signal is not supported in sigchild environment');
  98. }
  99. public function testStartAfterATimeout()
  100. {
  101. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  102. $this->markTestSkipped('Restarting a timed-out process on Windows is not supported in sigchild environment');
  103. }
  104. parent::testStartAfterATimeout();
  105. }
  106. public function testStopWithTimeoutIsActuallyWorking()
  107. {
  108. $this->markTestSkipped('Stopping with signal is not supported in sigchild environment');
  109. }
  110. public function testRunProcessWithTimeout()
  111. {
  112. $this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
  113. }
  114. public function testCheckTimeoutOnStartedProcess()
  115. {
  116. $this->markTestSkipped('Signal (required for timeout) is not supported in sigchild environment');
  117. }
  118. /**
  119. * {@inheritdoc}
  120. */
  121. protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array())
  122. {
  123. $process = new ProcessInSigchildEnvironment($commandline, $cwd, $env, $stdin, $timeout, $options);
  124. $process->setEnhanceSigchildCompatibility(true);
  125. return $process;
  126. }
  127. }