Skip to content

Commit d56ed2a

Browse files
Use the new way of setting the input stream
1 parent 194eea4 commit d56ed2a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/Helper/ApplicationTester.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
66
use Symfony\Component\Console\Helper\QuestionHelper;
77
use Symfony\Component\Console\Input\InputInterface;
8+
use Symfony\Component\Console\Input\StreamableInputInterface;
89
use Symfony\Component\Console\Input\StringInput;
910
use Symfony\Component\Console\Output\OutputInterface;
1011
use Symfony\Component\Console\Output\StreamOutput;
@@ -117,9 +118,14 @@ public function getStatusCode()
117118

118119
private function setInputStream($inputStream)
119120
{
120-
$helper = $this->application->getHelperSet()->get('question');
121-
/* @var $helper QuestionHelper */
122-
$helper->setInputStream($inputStream);
121+
if ($this->input instanceof StreamableInputInterface) {
122+
$this->input->setStream($inputStream);
123+
} else {
124+
// Symfony < 4.0
125+
$helper = $this->application->getHelperSet()->get('question');
126+
/* @var $helper QuestionHelper */
127+
$helper->setInputStream($inputStream);
128+
}
123129
}
124130

125131
private function disableStty()

0 commit comments

Comments
 (0)