minor #33877 Remove useless testCanCheckIfTerminalIsInteractive test case (ostrolucky)
This PR was merged into the 3.4 branch. Discussion ---------- Remove useless testCanCheckIfTerminalIsInteractive test case | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | This test case does not work for following reasons: 1. `$inputStream` is `NULL`. `posix_isatty` happily swallows null and returns `true`. Test would have to use [CommandTester::setInputs](ac4e9b0b26/src/Symfony/Component/Console/Tester/CommandTester.php (L66)
) or call `$tester->getInput()->setStream()` to fix this 1. Even if 1. is fixed, there are no internal `posix_isatty` calls going on. [ApplicationTester calls setInteractive only when such option is passed](b0a3208588/src/Symfony/Component/Console/Tester/ApplicationTester.php (L66)
), otherwise it will never be marked as interactive Commits -------a84e4e021a
Remove useless testCanCheckIfTerminalIsInteractive test case
This commit is contained in:
commit
718fb38db0
@ -1587,23 +1587,6 @@ class ApplicationTest extends TestCase
|
|||||||
$this->assertStringContainsString('The foo:bar command', $tester->getDisplay());
|
$this->assertStringContainsString('The foo:bar command', $tester->getDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @requires function posix_isatty
|
|
||||||
*/
|
|
||||||
public function testCanCheckIfTerminalIsInteractive()
|
|
||||||
{
|
|
||||||
$application = new CustomDefaultCommandApplication();
|
|
||||||
$application->setAutoExit(false);
|
|
||||||
|
|
||||||
$tester = new ApplicationTester($application);
|
|
||||||
$tester->run(['command' => 'help']);
|
|
||||||
|
|
||||||
$this->assertFalse($tester->getInput()->hasParameterOption(['--no-interaction', '-n']));
|
|
||||||
|
|
||||||
$inputStream = $tester->getInput()->getStream();
|
|
||||||
$this->assertEquals($tester->getInput()->isInteractive(), @posix_isatty($inputStream));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRunLazyCommandService()
|
public function testRunLazyCommandService()
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
|
Reference in New Issue
Block a user