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/input/input.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/input/input.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/input/input.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input.rs b/crates/shirabe-external-packages/src/symfony/console/input/input.rs index d13ab6c..d365f8d 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/input.rs @@ -4,7 +4,7 @@ use crate::symfony::console::exception::invalid_argument_exception::InvalidArgum use crate::symfony::console::exception::runtime_exception::RuntimeException; use crate::symfony::console::input::input_definition::InputDefinition; use indexmap::IndexMap; -use shirabe_php_shim::PhpMixed; +use shirabe_php_shim::{PhpMixed, PhpResource}; /// Input is the base class for all concrete Input classes. /// @@ -16,7 +16,7 @@ use shirabe_php_shim::PhpMixed; #[derive(Debug, Clone)] pub struct Input { pub(crate) definition: InputDefinition, - pub(crate) stream: PhpMixed, + pub(crate) stream: Option<PhpResource>, pub(crate) options: IndexMap<String, PhpMixed>, pub(crate) arguments: IndexMap<String, PhpMixed>, pub(crate) interactive: bool, @@ -26,7 +26,7 @@ impl Input { pub fn new(definition: Option<InputDefinition>) -> anyhow::Result<Self> { let mut input = Input { definition: InputDefinition::new(vec![])?, - stream: PhpMixed::Null, + stream: None, options: IndexMap::new(), arguments: IndexMap::new(), interactive: true, @@ -238,14 +238,11 @@ impl Input { } } - pub fn set_stream(&mut self, stream: PhpMixed) { - self.stream = stream; + pub fn set_stream(&mut self, stream: PhpResource) { + self.stream = Some(stream); } - pub fn get_stream(&self) -> Option<PhpMixed> { - match &self.stream { - PhpMixed::Null => None, - other => Some(other.clone()), - } + pub fn get_stream(&self) -> Option<PhpResource> { + self.stream.clone() } } |
