Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] How provide input stream for ApplicationTester? #24784

Closed
@Chi-teck

Description

@Chi-teck
Q A
Bug report? no
Feature request? yes
Symfony version 3.3.7

I am using the following code to test interactive console application.

$input_stream = $this->getInputStream("Some user input\n");
$question_helper = new QuestionHelper();
$question_helper->setInputStream($input_stream);

$helper_set = $application->getHelperSet();
$helper_set->set($question_helper);

$tester = new ApplicationTester($application);
$tester->run($arguments);

It works well but it is not compatible with Symfony 4 because setInputStream() method has been removed.

The documentation suggests using StreamableInputInterface::setStream() but I could not find any way to set Input for ApplicationTester.

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions