aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-19 19:41:15 +0900
committernsfisis <nsfisis@gmail.com>2026-07-19 19:46:21 +0900
commit9a2cee2532e5d28d5cea5726f35ab3c7046e7c0d (patch)
treed6d65791236f99e95879461553a12542693a5747 /crates/shirabe
parentfe0352e2db35ed559506c2b477708180768000e8 (diff)
downloadphp-shirabe-9a2cee2532e5d28d5cea5726f35ab3c7046e7c0d.tar.gz
php-shirabe-9a2cee2532e5d28d5cea5726f35ab3c7046e7c0d.tar.zst
php-shirabe-9a2cee2532e5d28d5cea5726f35ab3c7046e7c0d.zip
fix(root-package-loader): un-ignore 4 tests by fixing stability-flag isset() port
extract_stability_flags ported PHP's `isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability` as `unwrap_or(i64::MAX) > stability`, so the check always short-circuited to "already more unstable" and no flag (e.g. from an explicit `*@dev` requirement) was ever recorded. Fixed using Option::is_some_and, a direct translation of PHP's isset() && ... check. Also fixes tests/common/test_case.rs's shared installation_manager() helper, which built a real InstallationManager::new instead of the __new_mock constructor (mirroring PHP's FactoryMock::createInstallationManager()), so it always had zero installers registered and wrote install-path: null into fixture installed.json files. Un-ignores test_reinstall_command, test_locally_modified_packages_from_source/ _from_dist, and test_package_still_present_error_when_no_install_flag_used — the first three were already passing (their #[ignore] reasons were stale), the last is fixed by the test_case.rs change above. Updates the #[ignore] reasons on installer_test.rs's three fixture-driven integration tests to reflect their current state: the install pipeline now runs end-to-end, but the ~189-fixture installer/ set still hits several independent, unrelated bugs/gaps that need case-by-case triage rather than a single fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe')
-rw-r--r--crates/shirabe/src/package/loader/root_package_loader.rs4
-rw-r--r--crates/shirabe/tests/command/reinstall_command_test.rs1
-rw-r--r--crates/shirabe/tests/command/remove_command_test.rs1
-rw-r--r--crates/shirabe/tests/command/status_command_test.rs6
-rw-r--r--crates/shirabe/tests/common/test_case.rs2
-rw-r--r--crates/shirabe/tests/installer_test.rs6
6 files changed, 6 insertions, 14 deletions
diff --git a/crates/shirabe/src/package/loader/root_package_loader.rs b/crates/shirabe/src/package/loader/root_package_loader.rs
index b3ed8c41..95cd1225 100644
--- a/crates/shirabe/src/package/loader/root_package_loader.rs
+++ b/crates/shirabe/src/package/loader/root_package_loader.rs
@@ -337,7 +337,7 @@ impl RootPackageLoader {
let normalized_m1 = VersionParser::normalize_stability(&m1).unwrap_or_default();
let stability = stabilities[normalized_m1.as_str()];
- if stability_flags.get(&name).copied().unwrap_or(i64::MAX) > stability {
+ if stability_flags.get(&name).is_some_and(|&f| f > stability) {
continue;
}
stability_flags.insert(name, stability);
@@ -357,7 +357,7 @@ impl RootPackageLoader {
if stability_name != "stable" {
let name = strtolower(req_name);
let stability = stabilities[stability_name.as_str()];
- if stability_flags.get(&name).copied().unwrap_or(i64::MAX) > stability
+ if stability_flags.get(&name).is_some_and(|&f| f > stability)
|| minimum_stability_val > stability
{
continue;
diff --git a/crates/shirabe/tests/command/reinstall_command_test.rs b/crates/shirabe/tests/command/reinstall_command_test.rs
index ba3d39aa..ecd98c37 100644
--- a/crates/shirabe/tests/command/reinstall_command_test.rs
+++ b/crates/shirabe/tests/command/reinstall_command_test.rs
@@ -62,7 +62,6 @@ fn cases() -> Vec<(&'static str, Vec<(&'static str, PhpMixed)>, &'static str)> {
#[test]
#[serial]
-#[ignore = "ReinstallCommand::execute defers the two InstallationManager::execute(...) calls (Phase-C: needs a &mut InstalledRepositoryInterface view of local_repo, and InstallationManager::execute is itself todo!()), so no Removing/Installing lines are emitted and the output is empty. Only the \"not installed\" case, which aborts with warnings before reaching that code, would pass"]
fn test_reinstall_command() {
for (label, options, expected) in cases() {
let composer_json = serde_json::json!({
diff --git a/crates/shirabe/tests/command/remove_command_test.rs b/crates/shirabe/tests/command/remove_command_test.rs
index 64604632..75ef5075 100644
--- a/crates/shirabe/tests/command/remove_command_test.rs
+++ b/crates/shirabe/tests/command/remove_command_test.rs
@@ -811,7 +811,6 @@ fn test_warning_when_removing_packages_by_vendor_from_wrong_type() {
drop(tear_down);
}
-#[ignore = "installed.json records install-path: null instead of the expected \"../root/req\": the InstallationManager that writes the local repo in the --no-install (update && !install) flow has no installers registered (n_installers=0), so get_install_path()->get_installer() fails and yields null. Separate from the execute_batch fix; needs the default installers wired onto that manager."]
#[test]
#[serial]
fn test_package_still_present_error_when_no_install_flag_used() {
diff --git a/crates/shirabe/tests/command/status_command_test.rs b/crates/shirabe/tests/command/status_command_test.rs
index 9752fe1a..32b8390a 100644
--- a/crates/shirabe/tests/command/status_command_test.rs
+++ b/crates/shirabe/tests/command/status_command_test.rs
@@ -115,9 +115,6 @@ fn run_locally_modified_packages_case(
#[test]
#[serial]
-#[ignore = "runs `install` to download the package (git source / dist zip) before `status`, but \
- InstallationManager::execute is still a todo!() stub so install never populates vendor/, \
- and init_temp_composer disables packagist.org — running this needs a real VCS/zip fixture"]
fn test_locally_modified_packages_from_source() {
run_locally_modified_packages_case(
serde_json::json!({ "require": { "composer/class-map-generator": "^1.0" } }),
@@ -135,9 +132,6 @@ fn test_locally_modified_packages_from_source() {
#[test]
#[serial]
-#[ignore = "runs `install` to download the package (git source / dist zip) before `status`, but \
- InstallationManager::execute is still a todo!() stub so install never populates vendor/, \
- and init_temp_composer disables packagist.org — running this needs a real VCS/zip fixture"]
fn test_locally_modified_packages_from_dist() {
run_locally_modified_packages_case(
serde_json::json!({ "require": { "smarty/smarty": "^3.1" } }),
diff --git a/crates/shirabe/tests/common/test_case.rs b/crates/shirabe/tests/common/test_case.rs
index 2b94bbe1..6c3bb5ad 100644
--- a/crates/shirabe/tests/common/test_case.rs
+++ b/crates/shirabe/tests/common/test_case.rs
@@ -183,7 +183,7 @@ pub(crate) fn installation_manager(
config,
)));
let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
- std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::new(
+ std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::__new_mock(
r#loop,
io.clone(),
None,
diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs
index c9e0cf63..6c2ef63c 100644
--- a/crates/shirabe/tests/installer_test.rs
+++ b/crates/shirabe/tests/installer_test.rs
@@ -1225,7 +1225,7 @@ fn php_mixed_map_to_json(map: &IndexMap<String, PhpMixed>) -> serde_json::Value
}
#[test]
-#[ignore = "ported; exercises the full install pipeline which is not yet executable end-to-end (execute_batch / repository / autoload stubs), so cases are expected to fail at runtime"]
+#[ignore = "ported; loops over every installer-slow/ fixture and panics at the first mismatch. The install pipeline itself now runs end-to-end (execute_batch/InstallationManager are implemented), but individual fixtures still hit independent, unrelated bugs/gaps (solver stability-flag handling, funding-notice output, lock-file exit codes, at least one todo!() in shirabe-php-shim's runtime), so the full fixture set doesn't pass yet. Needs case-by-case triage rather than one fix"]
fn test_slow_integration() {
let _tear_down = TearDown;
for case in load_integration_tests("installer-slow/") {
@@ -1237,7 +1237,7 @@ fn test_slow_integration() {
}
#[test]
-#[ignore = "ported; exercises the full install pipeline which is not yet executable end-to-end (execute_batch / repository / autoload stubs), so cases are expected to fail at runtime"]
+#[ignore = "ported; loops over every installer/ fixture (189+) and panics at the first mismatch. The install pipeline itself now runs end-to-end (execute_batch/InstallationManager are implemented), but individual fixtures still hit independent, unrelated bugs/gaps (solver stability-flag handling, funding-notice output, lock-file exit codes, at least one todo!() in shirabe-php-shim's runtime), so the full fixture set doesn't pass yet. Needs case-by-case triage rather than one fix"]
fn test_integration_with_pool_optimizer() {
let _tear_down = TearDown;
for case in load_integration_tests("installer/") {
@@ -1253,7 +1253,7 @@ fn test_integration_with_pool_optimizer() {
}
#[test]
-#[ignore = "ported; exercises the full install pipeline which is not yet executable end-to-end (execute_batch / repository / autoload stubs), so cases are expected to fail at runtime"]
+#[ignore = "ported; loops over every installer/ fixture (189+) and panics at the first mismatch. The install pipeline itself now runs end-to-end (execute_batch/InstallationManager are implemented), but individual fixtures still hit independent, unrelated bugs/gaps (solver stability-flag handling, funding-notice output, lock-file exit codes, at least one todo!() in shirabe-php-shim's runtime), so the full fixture set doesn't pass yet. Needs case-by-case triage rather than one fix"]
fn test_integration_with_raw_pool() {
let _tear_down = TearDown;
for case in load_integration_tests("installer/") {