diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-23 03:49:00 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-23 03:49:29 +0900 |
| commit | 8fe3390d064303b86133a1d2983144a4818a7121 (patch) | |
| tree | 3d7979e8fcce3db28ec9edc9b1ce16a593026454 /crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs | |
| parent | c644aa4df0dfcd58e3f0a1372611921678ed6c6d (diff) | |
| download | php-shirabe-8fe3390d064303b86133a1d2983144a4818a7121.tar.gz php-shirabe-8fe3390d064303b86133a1d2983144a4818a7121.tar.zst php-shirabe-8fe3390d064303b86133a1d2983144a4818a7121.zip | |
test(command): port InitCommandTest
Port the pure-method cases (parse/namespace/formatAuthors/git/vendor-ignore)
and build the ApplicationTester / initTempComposer harness the run cases need.
Supporting production changes:
- carry the streamable input stream as PhpResource (not PhpMixed) and add
InputInterface::as_streamable so QuestionHelper reads the injected stream
- add StreamOutput/ConsoleOutput __set_stream test helpers and
ApplicationHandle::set_catch_exceptions for the tester
- implement the interact() author validator via parse_author_string
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs index f2c2a00..9eb8fff 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs @@ -66,12 +66,11 @@ impl QuestionHelper { return Ok(Ok(self.get_default_answer(question))); } - // TODO(phase-b): `$input instanceof StreamableInputInterface` cannot be - // expressed as a trait-object-to-trait-object downcast, and no concrete - // streamable input type is wired up yet. The stream is left unset so the - // helper falls back to STDIN. Revisit once StreamableInputInterface has a - // concrete implementor and the PhpResource/PhpMixed split is resolved. - let _ = &mut self.input_stream; + if let Some(streamable) = input.as_streamable() + && let Some(stream) = streamable.get_stream() + { + self.input_stream = Some(stream); + } let result: anyhow::Result<Result<PhpMixed, MissingInputException>> = (|| { if question.get_validator().is_none() { @@ -344,10 +343,7 @@ impl QuestionHelper { input_stream: &shirabe_php_shim::PhpResource, autocomplete: &dyn Fn(&str) -> Vec<PhpMixed>, ) -> String { - // TODO(phase-b): Cursor takes Option<PhpMixed>, but the input stream is a - // PhpResource and PhpMixed has no resource variant. Defaulting to STDIN - // until the PhpResource/PhpMixed stream representation is unified. - let cursor = Cursor::new(Rc::clone(&output), None); + let cursor = Cursor::new(Rc::clone(&output), Some(input_stream.clone())); let mut full_choice = String::new(); let mut ret = String::new(); |
