diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-20 08:21:48 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-20 08:24:45 +0900 |
| commit | 85fb9b70f4f41ead644b24f98052e6ffd9699e48 (patch) | |
| tree | ede4348cf68b94af923c1c8c0dd668c7f0aac043 /crates/shirabe/tests/command/diagnose_command_test.rs | |
| parent | 087865ef50283350a3cc74a5363ba44fa7dbe5c5 (diff) | |
| download | php-shirabe-85fb9b70f4f41ead644b24f98052e6ffd9699e48.tar.gz php-shirabe-85fb9b70f4f41ead644b24f98052e6ffd9699e48.tar.zst php-shirabe-85fb9b70f4f41ead644b24f98052e6ffd9699e48.zip | |
fix(diagnose-command): stop holding a Config borrow across http calls
execute() held &config.borrow() across check_http/check_composer_repo/
check_composer_audit, which reach HttpDownloader -> CurlDownloader::
download; that method does self.config.borrow_mut() on the same
Config RefCell, panicking with "RefCell already borrowed" once the
phpinfo panic that previously masked this was fixed.
Switch those three helpers to take the Rc<RefCell<Config>> handle
(matching check_version's existing pattern) and borrow only where a
field is actually read, so no borrow spans the downstream network
call. Un-ignore the now-passing run_diagnose smoke test and
test_cmd_fail; test_cmd_success stays ignored, now for two separate
reasons: it needs real network access (as the PHP original does), and
shirabe_php_shim::OPENSSL_VERSION_NUMBER is a hardcoded stub (0) that
always trips check_platform's TLSv1.1/1.2 support check regardless of
the real linked OpenSSL, forcing a non-zero exit code.
Diffstat (limited to 'crates/shirabe/tests/command/diagnose_command_test.rs')
| -rw-r--r-- | crates/shirabe/tests/command/diagnose_command_test.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/crates/shirabe/tests/command/diagnose_command_test.rs b/crates/shirabe/tests/command/diagnose_command_test.rs index 521cea84..f1bb2ef5 100644 --- a/crates/shirabe/tests/command/diagnose_command_test.rs +++ b/crates/shirabe/tests/command/diagnose_command_test.rs @@ -7,11 +7,6 @@ use shirabe_php_shim::PhpMixed; #[test] #[serial] -#[ignore = "DiagnoseCommand::check_http passes &config.borrow() into a call chain that reaches \ - CurlDownloader::download, which then does self.config.borrow_mut() on the same \ - Config RefCell, panicking with 'RefCell already borrowed'; beyond that, diagnose checks \ - live http/https connectivity to packagist and the github.com rate limit, so the test \ - also requires real network access (as the PHP original does)"] fn test_cmd_fail() { let tear_down = init_temp_composer( Some(&serde_json::json!({ "name": "foo/bar", "description": "test pkg" })), @@ -51,11 +46,11 @@ Checking github.com rate limit: " #[test] #[serial] -#[ignore = "DiagnoseCommand::check_http passes &config.borrow() into a call chain that reaches \ - CurlDownloader::download, which then does self.config.borrow_mut() on the same \ - Config RefCell, panicking with 'RefCell already borrowed'; beyond that, diagnose checks \ - live http/https connectivity to packagist and the github.com rate limit, so the test \ - also requires real network access (as the PHP original does)"] +#[ignore = "shirabe_php_shim::OPENSSL_VERSION_NUMBER is a hardcoded stub (0), which always trips \ + check_platform's `< 0x1000100f` TLSv1.1/1.2 support check regardless of the real \ + linked OpenSSL, forcing a non-zero exit code; diagnose also checks live http/https \ + connectivity to packagist and the github.com rate limit (as the PHP original does), \ + so the test additionally requires real network access"] fn test_cmd_success() { let tear_down = init_temp_composer( Some(&serde_json::json!({ |
