{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/18999","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/18999/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18999/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/18999/events","html_url":"https://github.com/symfony/symfony/pull/18999","id":159246551,"number":18999,"title":"[Console] Centralize input stream in base Input class","user":{"login":"chalasr","id":7502063,"avatar_url":"https://avatars.githubusercontent.com/u/7502063?v=3","gravatar_id":"","url":"https://api.github.com/users/chalasr","html_url":"https://github.com/chalasr","followers_url":"https://api.github.com/users/chalasr/followers","following_url":"https://api.github.com/users/chalasr/following{/other_user}","gists_url":"https://api.github.com/users/chalasr/gists{/gist_id}","starred_url":"https://api.github.com/users/chalasr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chalasr/subscriptions","organizations_url":"https://api.github.com/users/chalasr/orgs","repos_url":"https://api.github.com/users/chalasr/repos","events_url":"https://api.github.com/users/chalasr/events{/privacy}","received_events_url":"https://api.github.com/users/chalasr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Console","name":"Console","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Deprecation","name":"Deprecation","color":"f1c40f"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Review","name":"Status: Needs Review","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-06-08T19:05:21Z","updated_at":"2016-06-29T15:52:19Z","closed_at":"2016-06-16T06:26:07Z","pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18999","html_url":"https://github.com/symfony/symfony/pull/18999","diff_url":"https://github.com/symfony/symfony/pull/18999.diff","patch_url":"https://github.com/symfony/symfony/pull/18999.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | yes\r\n| Tests pass?   | yes\r\n| Fixed tickets | #10844 \r\n| License       | MIT\r\n| Doc PR        | not yet\r\n\r\nActually we have two classes that have an `inputStream` property with its getter+setter: \r\nthe QuestionHelper ('question' helper) and the SymfonyQuestionHelper (used via SymfonyStyle, that inherits the inputStream from the QuestionHelper class).\r\n\r\nThis situation makes command testing really hard. \r\nATM we can't test a command that uses `SymfonyStyle::ask` without ugly hacks, and we can't find a generic way to set the inputs passed to a command from the CommandTester, as it need to be done on a specific helper that may not be the one used by the command (SymfonyStyle case).\r\n\r\nWhat I propose here is to add a `stream` property (and its getter+setter) to the abstract `Symfony\\Component\\Console\\Input\\Input` class.\r\n\r\nFor now I just made the two helpers setting their `inputStream` from `Input::getStream`, as both QuestionHelper and SymfonyQuestionHelper classes have an `ask` method that takes the command Input as argument.\r\nIn a next time (4.0), we could remove the `getInputStream` and `setInputStream` methods from the QuestionHelper class (this only deprecates them in favor of Input `setStream` and `getStream`).\r\n\r\nThis would close PR #18902 (trying to make interactive command testing with SymfonyStyle easier).\r\nThis would also make PR #18710 widely better by setting the input stream in a generic way (working for both helpers without caring about if they are used and which one is used).\r\n\r\nPlease give me your opinions."},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/229400611","html_url":"https://github.com/symfony/symfony/pull/18999#issuecomment-229400611","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18999","id":229400611,"user":{"login":"chalasr","id":7502063,"avatar_url":"https://avatars.githubusercontent.com/u/7502063?v=3","gravatar_id":"","url":"https://api.github.com/users/chalasr","html_url":"https://github.com/chalasr","followers_url":"https://api.github.com/users/chalasr/followers","following_url":"https://api.github.com/users/chalasr/following{/other_user}","gists_url":"https://api.github.com/users/chalasr/gists{/gist_id}","starred_url":"https://api.github.com/users/chalasr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chalasr/subscriptions","organizations_url":"https://api.github.com/users/chalasr/orgs","repos_url":"https://api.github.com/users/chalasr/repos","events_url":"https://api.github.com/users/chalasr/events{/privacy}","received_events_url":"https://api.github.com/users/chalasr/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T15:52:18Z","updated_at":"2016-06-29T15:52:18Z","body":"@nicolas-grekas Just verified, there is no more calls to these methods in master, except for tests marked as legacy in `Symfony\\Component\\Console\\Tests\\Helper\\QuestionHelperTest` and `Symfony\\Component\\Console\\Tests\\Helper\\SymfonyQuestionHelperTest`, and (of course), the last call of `getInputStream()` ensuring BC in `Symfony\\Component\\Console\\Application`."}}
{"actor":{"display_login":"chalasr"}}