aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/command/validate_command_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-26 02:23:58 +0900
committernsfisis <nsfisis@gmail.com>2026-06-26 02:23:58 +0900
commit6c89c720d9e4728c288e3c66ffb7dcb4cba5121c (patch)
tree4697f897302425df1b57eb87bf9441308530d0bf /crates/shirabe/tests/command/validate_command_test.rs
parent4bd544608e4934fff4463fd6b104d06162a51ba0 (diff)
downloadphp-shirabe-6c89c720d9e4728c288e3c66ffb7dcb4cba5121c.tar.gz
php-shirabe-6c89c720d9e4728c288e3c66ffb7dcb4cba5121c.tar.zst
php-shirabe-6c89c720d9e4728c288e3c66ffb7dcb4cba5121c.zip
test(command): port show/remove/global/audit/check-platform-reqs/status/self-update/validate tests
Faithfully port the remaining stubbed command test bodies from their PHP counterparts (expected values verbatim). Newly passing: remove (6), global (2), check-platform-reqs (1), status (1), audit (1), self-update (1). Tests whose ported bodies reach a genuine unported src path keep faithful bodies but stay #[ignore] with precise reasons. Dominant blockers surfaced: - ShowCommand::configure stub (empty set_definition) blocks all 42 show tests - Composer-handle RefCell re-entrancy in the Installer (composer.rs:500) and Factory::create_composer (composer.rs:446) paths - check_platform_reqs nests InstalledRepository in InstalledRepository - audit's non-locked branch (audit_command.rs:285) and write_error3 re-entrancy Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/command/validate_command_test.rs')
-rw-r--r--crates/shirabe/tests/command/validate_command_test.rs30
1 files changed, 22 insertions, 8 deletions
diff --git a/crates/shirabe/tests/command/validate_command_test.rs b/crates/shirabe/tests/command/validate_command_test.rs
index 31af4be..5167fc0 100644
--- a/crates/shirabe/tests/command/validate_command_test.rs
+++ b/crates/shirabe/tests/command/validate_command_test.rs
@@ -1,6 +1,8 @@
//! ref: composer/tests/Composer/Test/Command/ValidateCommandTest.php
-use crate::test_case::{RunOptions, get_application_tester, init_temp_composer};
+use crate::test_case::{
+ RunOptions, create_composer_lock, get_application_tester, init_temp_composer,
+};
use serial_test::serial;
use shirabe::util::platform::Platform;
use shirabe_php_shim::PhpMixed;
@@ -86,9 +88,9 @@ fn provide_validate_tests() -> Vec<ValidateCase> {
#[test]
#[serial]
-#[ignore = "validate creates a Composer instance (create_composer_instance -> Factory) which \
- reaches ProcessExecutor (git) -> shirabe-php-shim stream_set_blocking (stream.rs \
- todo!(), requires fcntl(2))"]
+#[ignore = "validate creates a Composer instance (Factory::create_composer) which panics in \
+ PartialComposerHandle::borrow_partial at crates/shirabe/src/composer.rs:446 \
+ ('RefCell already mutably borrowed'); source-level borrow conflict, not a test issue"]
fn test_validate() {
for case in provide_validate_tests() {
let _tear_down = init_temp_composer(Some(&case.composer_json), None, None, true);
@@ -128,11 +130,23 @@ fn test_validate_on_file_issues() {
#[test]
#[serial]
-#[ignore = "validate with a lock file creates a Composer instance and queries the Locker, reaching \
- ProcessExecutor (git) -> shirabe-php-shim stream_set_blocking (stream.rs todo!(), \
- requires fcntl(2))"]
+#[ignore = "validate with a lock file creates a Composer instance (Factory::create_composer) which \
+ panics in PartialComposerHandle::borrow_partial at crates/shirabe/src/composer.rs:446 \
+ ('RefCell already mutably borrowed'); source-level borrow conflict, not a test issue"]
fn test_with_composer_lock() {
- todo!()
+ let tear_down = init_temp_composer(Some(&minimal_valid_configuration()), None, None, true);
+ create_composer_lock(&[], &[]);
+
+ let mut app_tester = get_application_tester();
+ app_tester
+ .run(validate_input(vec![]), RunOptions::default())
+ .unwrap();
+
+ let expected = "<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n./composer.json is valid but your composer.lock has some errors\n# Lock file errors\n- Required package \"root/req\" is not present in the lock file.\nThis usually happens when composer files are incorrectly merged or the composer.json file is manually edited.\nRead more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md\nand prefer using the \"require\" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r";
+
+ assert_eq!(expected.trim(), app_tester.get_display().trim());
+
+ drop(tear_down);
}
#[test]