From 8fe3390d064303b86133a1d2983144a4818a7121 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 23 Jun 2026 03:49:00 +0900 Subject: 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) --- .../src/symfony/console/helper/question_helper.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs') 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> = (|| { if question.get_validator().is_none() { @@ -344,10 +343,7 @@ impl QuestionHelper { input_stream: &shirabe_php_shim::PhpResource, autocomplete: &dyn Fn(&str) -> Vec, ) -> String { - // TODO(phase-b): Cursor takes Option, 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(); -- cgit v1.3.1