public static function setUpBeforeClass()
{
$phpBin = new PhpExecutableFinder();
- self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === PHP_SAPI ? 'php' : $phpBin->find());
+ self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
ob_start();
phpinfo(INFO_GENERAL);
*/
public function testInvalidCwd()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('False-positive on Windows/appveyor.');
}
public function testThatProcessDoesNotThrowWarningDuringRun()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test is transient on Windows');
}
@trigger_error('Test Error', E_USER_NOTICE);
$o = $p->getOutput();
- $this->assertEquals($expectedOutputSize, strlen($o));
+ $this->assertEquals($expectedOutputSize, \strlen($o));
}
public function testCallbacksAreExecutedWithStart()
$p->setInput($expected);
$p->run();
- $this->assertEquals($expectedLength, strlen($p->getOutput()));
- $this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
+ $this->assertEquals($expectedLength, \strlen($p->getOutput()));
+ $this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
}
/**
fclose($stream);
- $this->assertEquals($expectedLength, strlen($p->getOutput()));
- $this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
+ $this->assertEquals($expectedLength, \strlen($p->getOutput()));
+ $this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
}
public function testLiveStreamAsInput()
public function chainedCommandsOutputProvider()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
return array(
array("2 \r\n2\r\n", '&&', '2'),
);
public function testZeroAsOutput()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
$p = $this->getProcess('echo | set /p dummyName=0');
} else {
public function testExitCodeCommandFailed()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX exit code');
}
$this->skipIfNotEnhancedSigchild();
$this->assertGreaterThan(0, $process->getExitCode());
}
- /**
- * @group tty
- */
public function testTTYCommand()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not have /dev/tty support');
}
$this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
}
- /**
- * @group tty
- */
public function testTTYCommandExitCode()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does have /dev/tty support');
}
$this->skipIfNotEnhancedSigchild();
*/
public function testTTYInWindowsEnvironment()
{
- if ('\\' !== DIRECTORY_SEPARATOR) {
+ if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test is for Windows platform only');
}
{
$process = $this->getProcess('echo foo');
$process->run();
- $this->assertGreaterThan(0, strlen($process->getOutput()));
+ $this->assertGreaterThan(0, \strlen($process->getOutput()));
}
public function testGetExitCodeIsNullOnStart()
public function testProcessIsNotSignaled()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX signals');
}
$this->skipIfNotEnhancedSigchild();
public function testProcessWithoutTermSignal()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX signals');
}
$this->skipIfNotEnhancedSigchild();
public function testProcessIsSignaledIfStopped()
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX signals');
}
$this->skipIfNotEnhancedSigchild();
*/
public function testProcessThrowsExceptionWhenExternallySignaled()
{
- if (!function_exists('posix_kill')) {
+ if (!\function_exists('posix_kill')) {
$this->markTestSkipped('Function posix_kill is required.');
}
$this->skipIfNotEnhancedSigchild(false);
*/
public function testWrongSignal($signal)
{
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('POSIX signals do not work on Windows');
}
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
);
- if ('\\' === DIRECTORY_SEPARATOR) {
+ if ('\\' === \DIRECTORY_SEPARATOR) {
// Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
$sizes = array(1, 2, 4, 8);
} else {
{
$p = new Process(array('/usr/bin/php'));
- $expected = '\\' === DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
+ $expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
$this->assertSame($expected, $p->getCommandLine());
}
$p = new Process(array(self::$phpBin, '-r', 'echo $argv[1];', $arg));
$p->run();
- $this->assertSame($arg, $p->getOutput());
+ $this->assertSame((string) $arg, $p->getOutput());
}
/**
$p->inheritEnvironmentVariables(false);
$p->run();
- $this->assertSame($arg, $p->getOutput());
+ $this->assertSame((string) $arg, $p->getOutput());
}
public function testRawCommandLine()
yield array("a!b\tc");
yield array('a\\\\"\\"');
yield array('éÉèÈàÀöä');
+ yield array(null);
+ yield array(1);
+ yield array(1.1);
}
public function testEnvArgument()
{
$env = array('FOO' => 'Foo', 'BAR' => 'Bar');
- $cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
+ $cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
$p = new Process($cmd, null, $env);
$p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ'));
/**
* @param string $commandline
- * @param null|string $cwd
- * @param null|array $env
- * @param null|string $input
+ * @param string|null $cwd
+ * @param array|null $env
+ * @param string|null $input
* @param int $timeout
* @param array $options
*