Skip to content

Commit

Permalink
[Process] Dont test TTY if there is no TTY support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm authored and nicolas-grekas committed Nov 2, 2020
1 parent a537922 commit ec1482f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ public function testTTYCommand()
$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();
Expand All @@ -491,6 +495,10 @@ public function testTTYCommandExitCode()
$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();
Expand Down Expand Up @@ -1433,16 +1441,7 @@ public function testRawCommandLine()
$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()));
}

Expand Down

0 comments on commit ec1482f

Please sign in to comment.