aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-07 07:01:50 +0900
committernsfisis <nsfisis@gmail.com>2026-08-07 07:01:50 +0900
commit759b2980e70dfb8960238f75d68bb6dddce25414 (patch)
treee37a0af6423f8ae8dd26da309b278d49d45b3451 /crates/shirabe/src/util
parent9a393adc0ace86cac788723b524e83c63dfc91c1 (diff)
downloadphp-shirabe-759b2980e70dfb8960238f75d68bb6dddce25414.tar.gz
php-shirabe-759b2980e70dfb8960238f75d68bb6dddce25414.tar.zst
php-shirabe-759b2980e70dfb8960238f75d68bb6dddce25414.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util')
-rw-r--r--crates/shirabe/src/util/auth_helper.rs33
1 files changed, 33 insertions, 0 deletions
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<String>,
+ origin: &str,
+ url: &str,
+ ) -> anyhow::Result<Vec<String>> {
+ 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<String, PhpMixed> = IndexMap::new();
+ http.insert(
+ "header".to_string(),
+ PhpMixed::List(headers.into_iter().map(PhpMixed::String).collect()),
+ );
+ let mut options: IndexMap<String, PhpMixed> = 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<string, mixed> updated options
pub fn add_authentication_options(
&mut self,