You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #15794 [Console] default to stderr in the console helpers (alcohol)
This PR was squashed before being merged into the 2.3 branch (closes#15794).
Discussion
----------
[Console] default to stderr in the console helpers
Interactive input/output and informational output such as progress should go to `stderr` if available.
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
See #13730 also for previous discussion.
If someone explicitly wants to use `stdout`, they can simply pass `$output->getStream()` instead of `$output` in most use-cases.
Commits
-------
3d4e95e [Console] default to stderr in the console helpers
class DialogHelperTest extends \PHPUnit_Framework_TestCase
@@ -50,6 +51,22 @@ public function testSelect()
50
51
$this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, ' 0 , 1 ', false, 'Input "%s" is not a superhero!', true));
$this->assertEquals('1', $dialog->select($output = $this->getConsoleOutput($this->getOutputStream()), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', false));
65
+
66
+
rewind($output->getErrorOutput()->getStream());
67
+
$this->assertContains('Input "Stdout" is not a superhero!', stream_get_contents($output->getErrorOutput()->getStream()));
68
+
}
69
+
53
70
publicfunctiontestAsk()
54
71
{
55
72
$dialog = newDialogHelper();
@@ -63,6 +80,22 @@ public function testAsk()
63
80
$this->assertEquals('What time is it?', stream_get_contents($output->getStream()));
64
81
}
65
82
83
+
publicfunctiontestAskOnErrorOutput()
84
+
{
85
+
if (!$this->hasSttyAvailable()) {
86
+
$this->markTestSkipped('`stderr` is required to test stderr output functionality');
0 commit comments