SimpleProcessTest.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. use Symfony\Component\Process\Process;
  12. class SimpleProcessTest extends AbstractProcessTest
  13. {
  14. private $enabledSigchild = false;
  15. public function setUp()
  16. {
  17. ob_start();
  18. phpinfo(INFO_GENERAL);
  19. $this->enabledSigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  20. }
  21. public function testGetExitCode()
  22. {
  23. $this->skipIfPHPSigchild();
  24. parent::testGetExitCode();
  25. }
  26. public function testExitCodeCommandFailed()
  27. {
  28. $this->skipIfPHPSigchild();
  29. parent::testExitCodeCommandFailed();
  30. }
  31. public function testProcessIsSignaledIfStopped()
  32. {
  33. $this->skipIfPHPSigchild();
  34. parent::testProcessIsSignaledIfStopped();
  35. }
  36. public function testProcessWithTermSignal()
  37. {
  38. $this->skipIfPHPSigchild();
  39. parent::testProcessWithTermSignal();
  40. }
  41. public function testProcessIsNotSignaled()
  42. {
  43. $this->skipIfPHPSigchild();
  44. parent::testProcessIsNotSignaled();
  45. }
  46. public function testProcessWithoutTermSignal()
  47. {
  48. $this->skipIfPHPSigchild();
  49. parent::testProcessWithoutTermSignal();
  50. }
  51. public function testExitCodeText()
  52. {
  53. $this->skipIfPHPSigchild();
  54. parent::testExitCodeText();
  55. }
  56. public function testIsSuccessful()
  57. {
  58. $this->skipIfPHPSigchild();
  59. parent::testIsSuccessful();
  60. }
  61. public function testIsNotSuccessful()
  62. {
  63. $this->skipIfPHPSigchild();
  64. parent::testIsNotSuccessful();
  65. }
  66. /**
  67. * {@inheritdoc}
  68. */
  69. protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array())
  70. {
  71. return new Process($commandline, $cwd, $env, $stdin, $timeout, $options);
  72. }
  73. private function skipIfPHPSigchild()
  74. {
  75. if ($this->enabledSigchild) {
  76. $this->markTestSkipped('Your PHP has been compiled with --enable-sigchild, this test can not be executed');
  77. }
  78. }
  79. }