diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-20 03:14:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-20 03:14:31 +0900 |
| commit | 72e3ec4a52e29ae01187445ba923aed3421af345 (patch) | |
| tree | 46455ecf3963afbfb4c8b50be32ea4b48af0b2c1 | |
| parent | 5fac1bba14ad5b9e4d2abfa3ca299f88cc1e62bf (diff) | |
| download | php-shirabe-72e3ec4a52e29ae01187445ba923aed3421af345.tar.gz php-shirabe-72e3ec4a52e29ae01187445ba923aed3421af345.tar.zst php-shirabe-72e3ec4a52e29ae01187445ba923aed3421af345.zip | |
fix(validating-array-loader): un-ignore test_fund_command by fixing empty check
validate_array judged emptiness via as_array(), which only matches
PhpMixed::Array, so a non-empty PhpMixed::List (e.g. a funding array) was
misjudged as empty and dropped, diverging from PHP's !count() check.
Match both Array and List.
The stale ignore reason on test_fund_command no longer applies:
init_temp_composer injects packagist:false so no network is reached, and
the downloader stack is reqwest-based (no curl shim todo!()).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| -rw-r--r-- | crates/shirabe/src/package/loader/validating_array_loader.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/tests/command/fund_command_test.rs | 3 |
2 files changed, 6 insertions, 7 deletions
diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs index 28ae7d9b..da022b1b 100644 --- a/crates/shirabe/src/package/loader/validating_array_loader.rs +++ b/crates/shirabe/src/package/loader/validating_array_loader.rs @@ -1468,10 +1468,12 @@ impl ValidatingArrayLoader { } let is_empty = !self.config.borrow().contains_key(property) - || self.config.borrow()[property] - .as_array() - .map(|m| m.is_empty()) - .unwrap_or(true); + || match &self.config.borrow()[property] { + PhpMixed::Array(m) => m.is_empty(), + PhpMixed::List(l) => l.is_empty(), + // is_array() above guarantees the value is Array or List here. + _ => unreachable!("validate_array: non-array value survived the is_array check"), + }; if is_empty { if mandatory { self.errors.borrow_mut().push(format!( diff --git a/crates/shirabe/tests/command/fund_command_test.rs b/crates/shirabe/tests/command/fund_command_test.rs index bbcc5892..22b9b060 100644 --- a/crates/shirabe/tests/command/fund_command_test.rs +++ b/crates/shirabe/tests/command/fund_command_test.rs @@ -72,9 +72,6 @@ fn run_fund_case( #[test] #[serial] -#[ignore = "FundCommand queries every repository (incl. the default packagist ComposerRepository) over \ - HTTP for funding metadata before falling back to locally installed data, reaching \ - shirabe-php-shim curl.rs curl_version (todo!()); this path needs real network access"] fn test_fund_command() { // 'no funding links present, locally or remotely' run_fund_case( |
