From e98823e599eb375b30037cc714710e3309d927d1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 27 Jun 2026 17:21:00 +0900 Subject: test: port Composer tests unblocked by mockall, add seams Port 11 categories of previously-ignored Composer tests now reachable with the mockall crate: DownloadManager, VCS/Perforce/File downloaders, VersionSelector, PlatformRepository, Auditor, installer/FilesystemRepository, RootPackageLoader, util auth/http, commands, and Cache. Extract test seams additively on concrete structs as *Interface traits (Runtime, HhvmDetector, VersionGuesser, RepositorySet, Perforce, BinaryInstaller) plus mock-field seams (Cache, Filesystem); consumers take trait objects. Mocks are defined locally in the test crates via mockall::mock!, since automock-generated mocks are cfg(test)-gated and invisible across the integration-test boundary. dataProviders are ported in full; tests blocked by unported shims stay #[ignore] with documented reasons rather than reduced or weakened. Fix product bugs surfaced by the ports: - util/github: use the exception code, not the HTTP status, for 401/403 - advisory: serialize empty audit maps as [] to match PHP json_encode - repository/filesystem and downloader/file: fix RefCell double-borrow panics Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/tests/command/status_command_test.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/tests/command/status_command_test.rs') diff --git a/crates/shirabe/tests/command/status_command_test.rs b/crates/shirabe/tests/command/status_command_test.rs index aa0ecc6..f10df7b 100644 --- a/crates/shirabe/tests/command/status_command_test.rs +++ b/crates/shirabe/tests/command/status_command_test.rs @@ -39,9 +39,11 @@ fn test_no_local_changes() { drop(tear_down); } -#[ignore = "exercises `install` over the network (downloads composer/class-map-generator from a git \ - source or smarty/smarty from a dist zip), then mutates the installed package and runs \ - `status`; the install path needs real network access"] +#[ignore = "not a partial-mock test: it runs `install` to download composer/class-map-generator (git \ + source) or smarty/smarty (dist zip), mutates the installed package, then runs `status`. \ + Porting without network would require fabricating a real git checkout under vendor/, a \ + `.git` metadata repo, and wiring download-manager routing so GitDownloader::get_local_changes \ + runs `git status` against it — a full VCS integration fixture, not a SUT seam"] #[test] fn test_locally_modified_packages() { todo!() -- cgit v1.3.1