[Process] Dont test TTY if there is no TTY support

This commit is contained in:
Nyholm 2020-11-01 20:26:06 +01:00 committed by Nicolas Grekas
parent 91fb5fae36
commit e918e5ab30
1 changed files with 9 additions and 10 deletions

View File

@ -476,6 +476,10 @@ class ProcessTest extends TestCase
$this->markTestSkipped('Windows does not have /dev/tty support');
}
if (!Process::isTtySupported()) {
$this->markTestSkipped('There is no TTY support');
}
$process = $this->getProcess('echo "foo" >> /dev/null && '.$this->getProcessForCode('usleep(100000);')->getCommandLine());
$process->setTty(true);
$process->start();
@ -491,6 +495,10 @@ class ProcessTest extends TestCase
$this->markTestSkipped('Windows does have /dev/tty support');
}
if (!Process::isTtySupported()) {
$this->markTestSkipped('There is no TTY support');
}
$process = $this->getProcess('echo "foo" >> /dev/null');
$process->setTty(true);
$process->run();
@ -1433,16 +1441,7 @@ class ProcessTest extends TestCase
$p = Process::fromShellCommandline(sprintf('"%s" -r %s "a" "" "b"', self::$phpBin, escapeshellarg('print_r($argv);')));
$p->run();
$expected = <<<EOTXT
Array
(
[0] => -
[1] => a
[2] =>
[3] => b
)
EOTXT;
$expected = "Array\n(\n [0] => -\n [1] => a\n [2] => \n [3] => b\n)\n";
$this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput()));
}