aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 05:17:53 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 11:49:31 +0900
commit4b92ecafd7634ad99aa432d58fbc1958d1f01270 (patch)
tree7967e53dc0fa9be5ba525c2ec8ce6496aa559857 /crates/shirabe/tests/repository
parent3efcd8d338aa49efb0c9075c0f7a4dd4e4138b7d (diff)
downloadphp-shirabe-4b92ecafd7634ad99aa432d58fbc1958d1f01270.tar.gz
php-shirabe-4b92ecafd7634ad99aa432d58fbc1958d1f01270.tar.zst
php-shirabe-4b92ecafd7634ad99aa432d58fbc1958d1f01270.zip
test: port remaining repository and util tests as stubs
All ignored: Composer/Filesystem/Platform/Vcs repositories and the AuthHelper/Bitbucket/Git/Perforce/RemoteFilesystem/Svn utils mock IO/Config/HttpDownloader(curl)/ProcessExecutor or use reflection; Filesystem/ProcessExecutor/StreamContextFactory/ProxyManager need on-disk fixtures or proxy env. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository')
-rw-r--r--crates/shirabe/tests/repository/composer_repository_test.rs23
-rw-r--r--crates/shirabe/tests/repository/filesystem_repository_test.rs20
-rw-r--r--crates/shirabe/tests/repository/main.rs4
-rw-r--r--crates/shirabe/tests/repository/platform_repository_test.rs20
-rw-r--r--crates/shirabe/tests/repository/vcs/svn_driver_test.rs5
-rw-r--r--crates/shirabe/tests/repository/vcs_repository_test.rs9
6 files changed, 80 insertions, 1 deletions
diff --git a/crates/shirabe/tests/repository/composer_repository_test.rs b/crates/shirabe/tests/repository/composer_repository_test.rs
index 627027a..89c55b5 100644
--- a/crates/shirabe/tests/repository/composer_repository_test.rs
+++ b/crates/shirabe/tests/repository/composer_repository_test.rs
@@ -1 +1,24 @@
//! ref: composer/tests/Composer/Test/Repository/ComposerRepositoryTest.php
+
+// These construct a ComposerRepository with a mocked HttpDownloader/IO/Config and parse
+// provider/package data whose constraints go through a look-around regex; mocking is not
+// available and a real HttpDownloader reaches curl_multi_init (todo!()).
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_load_data);
+stub!(test_what_provides);
+stub!(test_search_with_type);
+stub!(test_search_with_special_chars);
+stub!(test_search_with_abandoned_packages);
+stub!(test_canonicalize_url);
+stub!(test_get_provider_names_will_return_partial_package_names);
+stub!(test_get_security_advisories_assert_repository_http_options_are_used);
+stub!(test_get_security_advisories_assert_repository_advisories_is_zero_indexed_array_with_consecutive_keys);
diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs
index 83f879d..74a6794 100644
--- a/crates/shirabe/tests/repository/filesystem_repository_test.rs
+++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs
@@ -1 +1,21 @@
//! ref: composer/tests/Composer/Test/Repository/FilesystemRepositoryTest.php
+
+// These read/write installed.json and installed.php fixtures via JsonFile and assert the
+// generated output; the file IO/manipulation (JsonManipulator reaches addcslashes, todo!())
+// and fixtures are not ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_repository_read);
+stub!(test_corrupted_repository_file);
+stub!(test_unexistent_repository_file);
+stub!(test_repository_write);
+stub!(test_repository_writes_installed_php);
+stub!(test_safely_load_installed_versions);
diff --git a/crates/shirabe/tests/repository/main.rs b/crates/shirabe/tests/repository/main.rs
index 54687d8..2995b24 100644
--- a/crates/shirabe/tests/repository/main.rs
+++ b/crates/shirabe/tests/repository/main.rs
@@ -3,11 +3,15 @@ mod test_case;
mod array_repository_test;
mod artifact_repository_test;
+mod composer_repository_test;
mod composite_repository_test;
+mod filesystem_repository_test;
mod filter_repository_test;
mod installed_repository_test;
mod path_repository_test;
+mod platform_repository_test;
mod repository_factory_test;
mod repository_manager_test;
mod repository_utils_test;
mod vcs;
+mod vcs_repository_test;
diff --git a/crates/shirabe/tests/repository/platform_repository_test.rs b/crates/shirabe/tests/repository/platform_repository_test.rs
index d4028b1..d06f8f5 100644
--- a/crates/shirabe/tests/repository/platform_repository_test.rs
+++ b/crates/shirabe/tests/repository/platform_repository_test.rs
@@ -1 +1,21 @@
//! ref: composer/tests/Composer/Test/Repository/PlatformRepositoryTest.php
+
+// These probe runtime/extension/library versions and assert the synthesized platform
+// packages; the detection mocks ProcessExecutor/Runtime/HhvmDetector and the package
+// versions are parsed through a look-around regex.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_hhvm_package);
+stub!(test_php_version);
+stub!(test_inet_pton_regression);
+stub!(test_library_information);
+stub!(test_composer_platform_version);
+stub!(test_valid_platform_packages);
diff --git a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
index 64108c6..262f0c3 100644
--- a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
@@ -23,7 +23,10 @@ fn test_support() {
let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
let config = Rc::new(RefCell::new(Config::new(true, None)));
- assert_eq!(assertion, SvnDriver::supports(io, config, url, false).unwrap());
+ assert_eq!(
+ assertion,
+ SvnDriver::supports(io, config, url, false).unwrap()
+ );
}
}
diff --git a/crates/shirabe/tests/repository/vcs_repository_test.rs b/crates/shirabe/tests/repository/vcs_repository_test.rs
index a830f0e..b9486fc 100644
--- a/crates/shirabe/tests/repository/vcs_repository_test.rs
+++ b/crates/shirabe/tests/repository/vcs_repository_test.rs
@@ -1 +1,10 @@
//! ref: composer/tests/Composer/Test/Repository/VcsRepositoryTest.php
+
+// testLoadVersions initialises a real git repository on disk and drives a VcsRepository over
+// it, then asserts the loaded package versions; the git fixture setup and constraint parsing
+// (look-around regex) are not ported.
+#[test]
+#[ignore = "not yet ported (initialises a git repo on disk and loads versions; constraint parsing uses a look-around regex)"]
+fn test_load_versions() {
+ todo!()
+}