diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 09:14:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 09:14:11 +0900 |
| commit | 6643eb8b7d305818f80c910144b3b29b1af34ba7 (patch) | |
| tree | 3baee8b2291725add75e9963d7666890aae62760 /crates/shirabe/tests/repository | |
| parent | be514aeff17ab7d8debcc59acddd07f7c7b72bd7 (diff) | |
| download | php-shirabe-6643eb8b7d305818f80c910144b3b29b1af34ba7.tar.gz php-shirabe-6643eb8b7d305818f80c910144b3b29b1af34ba7.tar.zst php-shirabe-6643eb8b7d305818f80c910144b3b29b1af34ba7.zip | |
refactor(installed-versions): drop the Rust port, which has no readers
InstalledVersions is a runtime API for plugins and project code; Composer
itself never reads it. Its consumers run in the PHP worker against the copy
FilesystemRepository dumps to vendor/composer/InstalledVersions.php, whose
static state is already kept in sync by __shirabe_installed_versions_reload.
Nothing in Rust read the mirrored statics, so reload() and the reflection
setters were no-ops.
The tests covered only the Rust port, not the PHP class the worker loads, so
they assert nothing about compatibility; they are left as todo!() skeletons.
This also removes the shim functions method_exists, php_dir and
require_php_file, whose only caller was the deleted module.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository')
| -rw-r--r-- | crates/shirabe/tests/repository/filesystem_repository_test.rs | 69 |
1 files changed, 4 insertions, 65 deletions
diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs index a9ac91a0..b87e1502 100644 --- a/crates/shirabe/tests/repository/filesystem_repository_test.rs +++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs @@ -4,7 +4,6 @@ use crate::test_case::{get_alias_package, get_package}; use indexmap::IndexMap; use serial_test::serial; use shirabe::dependency_resolver::operation::AnyOperation; -use shirabe::installed_versions::InstalledVersions; use shirabe::installer::{InstallationManagerInterface, InstallerInterface}; use shirabe::io::IOInterface; use shirabe::json::json_file::JsonFile; @@ -326,70 +325,10 @@ fn test_repository_writes_installed_php() { assert_eq!(expected, actual); } -#[ignore = "safely_load_installed_versions's pattern uses a PCRE (?(DEFINE)...) recursive grammar the regex crate cannot compile"] +#[ignore = "safely_load_installed_versions's pattern uses a PCRE (?(DEFINE)...) recursive grammar the regex crate cannot compile, and InstalledVersions::getAllRawData has no Rust counterpart"] #[test] fn test_safely_load_installed_versions() { - let fixtures_dir = format!( - "{}/../../composer/tests/Composer/Test/Repository/Fixtures", - env!("CARGO_MANIFEST_DIR") - ); - let path = format!("{}/installed_complex.php", fixtures_dir); - - let result = FilesystemRepository::safely_load_installed_versions(&path); - assert!(result, "The file should be considered valid"); - - let raw_data = InstalledVersions::get_all_raw_data(); - let raw_data = raw_data.last().cloned().unwrap(); - - let mut root: IndexMap<String, PhpMixed> = IndexMap::new(); - root.insert( - "install_path".to_string(), - PhpMixed::String(format!("{}/./", fixtures_dir)), - ); - root.insert( - "aliases".to_string(), - PhpMixed::List(vec![ - PhpMixed::String("1.10.x-dev".to_string()), - PhpMixed::String("2.10.x-dev".to_string()), - ]), - ); - root.insert("name".to_string(), PhpMixed::String("__root__".to_string())); - root.insert("true".to_string(), PhpMixed::Bool(true)); - root.insert("false".to_string(), PhpMixed::Bool(false)); - root.insert("null".to_string(), PhpMixed::Null); - - let mut a_provider: IndexMap<String, PhpMixed> = IndexMap::new(); - a_provider.insert( - "foo".to_string(), - PhpMixed::String("simple string/no backslash".to_string()), - ); - a_provider.insert( - "install_path".to_string(), - PhpMixed::String(format!( - "{}/vendor/{{${{passthru('bash -i')}}}}", - fixtures_dir - )), - ); - a_provider.insert("empty array".to_string(), PhpMixed::List(vec![])); - - let mut c_c: IndexMap<String, PhpMixed> = IndexMap::new(); - c_c.insert( - "install_path".to_string(), - PhpMixed::String("/foo/bar/ven/do{}r/c/c${}".to_string()), - ); - c_c.insert("aliases".to_string(), PhpMixed::List(vec![])); - c_c.insert( - "reference".to_string(), - PhpMixed::String("{${passthru('bash -i')}} Foo\\Bar\n\ttab\u{0b}verticaltab\0".to_string()), - ); - - let mut versions: IndexMap<String, PhpMixed> = IndexMap::new(); - versions.insert("a/provider".to_string(), PhpMixed::Array(a_provider)); - versions.insert("c/c".to_string(), PhpMixed::Array(c_c)); - - let mut expected: IndexMap<String, PhpMixed> = IndexMap::new(); - expected.insert("root".to_string(), PhpMixed::Array(root)); - expected.insert("versions".to_string(), PhpMixed::Array(versions)); - - assert_eq!(raw_data, expected); + // TODO(phase-d): needs a regex-crate expression equivalent to the PCRE recursive grammar, and + // InstalledVersions::get_all_raw_data. + todo!() } |
