From 759b2980e70dfb8960238f75d68bb6dddce25414 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 7 Aug 2026 07:01:50 +0900 Subject: test: port the tests left as todo!() stubs Replace the todo!() bodies with real ports. Four autoload-generator tests now run for real; the rest stay #[ignore]d, but each ignore reason now names the concrete missing symbol instead of a vague subsystem. Production additions the ports need: the deprecated AuthHelper::addAuthenticationHeader wrapper, EventDispatcher::__set_dispatch_script_override as the seam for PHPUnit onlyMethods(['dispatchScript']), and a define() stub in the shim. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/util/auth_helper.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'crates/shirabe/src/util') diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index c779a1bb..a323c37e 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -436,6 +436,39 @@ impl AuthHelper { }) } + /// @param string[] $headers + /// + /// @return string[] updated headers array + pub fn add_authentication_header( + &mut self, + headers: Vec, + origin: &str, + url: &str, + ) -> anyhow::Result> { + shirabe_php_shim::trigger_error( + "AuthHelper::addAuthenticationHeader is deprecated since Composer 2.9 use addAuthenticationOptions instead.", + shirabe_php_shim::E_USER_DEPRECATED, + ); + + let mut http: IndexMap = IndexMap::new(); + http.insert( + "header".to_string(), + PhpMixed::List(headers.into_iter().map(PhpMixed::String).collect()), + ); + let mut options: IndexMap = IndexMap::new(); + options.insert("http".to_string(), PhpMixed::Array(http)); + let options = self.add_authentication_options(options, origin, url)?; + + Ok(options["http"] + .as_array() + .and_then(|http| http.get("header")) + .and_then(|header| header.as_list()) + .expect("addAuthenticationOptions always leaves http.header a list") + .iter() + .map(|v| v.as_string().unwrap_or("").to_string()) + .collect()) + } + /// @return array updated options pub fn add_authentication_options( &mut self, -- cgit v1.3.1