[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

View File

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