Skip to content

Commit

Permalink
bug #38950 [Process] Dont test TTY if there is no TTY support (Nyholm)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38946
| License       | MIT
| Doc PR        |

Commits
-------

e918e5a [Process] Dont test TTY if there is no TTY support
  • Loading branch information
nicolas-grekas committed Nov 2, 2020
2 parents ca9ef82 + e918e5a commit ed217a1
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Symfony/Component/Process/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 ed217a1

Please sign in to comment.