aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 05:09:56 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 05:09:56 +0900
commit25f96cab45f5da4fba2ef0486a0b0bc8f7ca87b0 (patch)
tree0974de4f5e7a19415f2bcda9adc34cb95263b2e9 /crates/shirabe/tests
parentb07f3a9f51d7ce5ea8ee4dc45da7fe9a55b7f1d4 (diff)
downloadphp-shirabe-25f96cab45f5da4fba2ef0486a0b0bc8f7ca87b0.tar.gz
php-shirabe-25f96cab45f5da4fba2ef0486a0b0bc8f7ca87b0.tar.zst
php-shirabe-25f96cab45f5da4fba2ef0486a0b0bc8f7ca87b0.zip
test: port downloader/installer/io/json/event-dispatcher/functional stubs
All ignored: these mock IO/HttpDownloader (curl)/ProcessExecutor/installers, use ZipArchive/JsonManipulator todo!()s, need Symfony console or schema validation, reflect into ClassLoader, or run end-to-end install/functional fixtures. Wires up the event_dispatcher test target. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests')
-rw-r--r--crates/shirabe/tests/all_functional_test.rs16
-rw-r--r--crates/shirabe/tests/downloader/download_manager_test.rs44
-rw-r--r--crates/shirabe/tests/downloader/file_downloader_test.rs22
-rw-r--r--crates/shirabe/tests/downloader/git_downloader_test.rs29
-rw-r--r--crates/shirabe/tests/downloader/main.rs4
-rw-r--r--crates/shirabe/tests/downloader/zip_downloader_test.rs21
-rw-r--r--crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs29
-rw-r--r--crates/shirabe/tests/event_dispatcher/main.rs1
-rw-r--r--crates/shirabe/tests/installed_versions_test.rs27
-rw-r--r--crates/shirabe/tests/installer/installation_manager_test.rs21
-rw-r--r--crates/shirabe/tests/installer/library_installer_test.rs22
-rw-r--r--crates/shirabe/tests/installer/main.rs3
-rw-r--r--crates/shirabe/tests/installer/suggested_packages_reporter_test.rs24
-rw-r--r--crates/shirabe/tests/installer_test.rs18
-rw-r--r--crates/shirabe/tests/io/console_io_test.rs26
-rw-r--r--crates/shirabe/tests/io/main.rs1
-rw-r--r--crates/shirabe/tests/json/composer_schema_test.rs18
-rw-r--r--crates/shirabe/tests/json/main.rs1
18 files changed, 327 insertions, 0 deletions
diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs
index 88ab725..99a7ad0 100644
--- a/crates/shirabe/tests/all_functional_test.rs
+++ b/crates/shirabe/tests/all_functional_test.rs
@@ -1 +1,17 @@
//! ref: composer/tests/Composer/Test/AllFunctionalTest.php
+
+// These build the composer.phar and run the .test integration fixtures by invoking the
+// composer binary as a subprocess; the phar build and functional-test harness are not
+// ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "not yet ported (builds composer.phar and runs the functional .test fixtures via the binary)"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_build_phar);
+stub!(test_integration);
diff --git a/crates/shirabe/tests/downloader/download_manager_test.rs b/crates/shirabe/tests/downloader/download_manager_test.rs
index b13420b..a047420 100644
--- a/crates/shirabe/tests/downloader/download_manager_test.rs
+++ b/crates/shirabe/tests/downloader/download_manager_test.rs
@@ -1 +1,45 @@
//! ref: composer/tests/Composer/Test/Downloader/DownloadManagerTest.php
+
+// These mock IO and individual downloaders to drive DownloadManager's selection/download/
+// update/remove logic; mocking is not available here.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks IO and individual downloaders to drive DownloadManager; mocking is not available"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_set_get_downloader);
+stub!(test_get_downloader_for_incorrectly_installed_package);
+stub!(test_get_downloader_for_correctly_installed_dist_package);
+stub!(test_get_downloader_for_incorrectly_installed_dist_package);
+stub!(test_get_downloader_for_correctly_installed_source_package);
+stub!(test_get_downloader_for_incorrectly_installed_source_package);
+stub!(test_get_downloader_for_metapackage);
+stub!(test_full_package_download);
+stub!(test_full_package_download_failover);
+stub!(test_bad_package_download);
+stub!(test_dist_only_package_download);
+stub!(test_source_only_package_download);
+stub!(test_metapackage_package_download);
+stub!(test_full_package_download_with_source_preferred);
+stub!(test_dist_only_package_download_with_source_preferred);
+stub!(test_source_only_package_download_with_source_preferred);
+stub!(test_bad_package_download_with_source_preferred);
+stub!(test_update_dist_with_equal_types);
+stub!(test_update_dist_with_not_equal_types);
+stub!(test_get_available_sources_update_sticks_to_same_source);
+stub!(test_update_metapackage);
+stub!(test_remove);
+stub!(test_metapackage_remove);
+stub!(test_install_preference_without_preference_dev);
+stub!(test_install_preference_without_preference_no_dev);
+stub!(test_install_preference_without_match_dev);
+stub!(test_install_preference_without_match_no_dev);
+stub!(test_install_preference_with_match_auto_dev);
+stub!(test_install_preference_with_match_auto_no_dev);
+stub!(test_install_preference_with_match_source);
+stub!(test_install_preference_with_match_dist);
diff --git a/crates/shirabe/tests/downloader/file_downloader_test.rs b/crates/shirabe/tests/downloader/file_downloader_test.rs
index 54afad4..4e9cbc6 100644
--- a/crates/shirabe/tests/downloader/file_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/file_downloader_test.rs
@@ -1 +1,23 @@
//! ref: composer/tests/Composer/Test/Downloader/FileDownloaderTest.php
+
+// These construct a FileDownloader with a mocked IO/HttpDownloader (curl_multi_init todo!())
+// and a mocked Cache/Package to drive download/checksum behaviour.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks IO/HttpDownloader (curl_multi_init todo!()) and Cache/Package"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_download_for_package_without_dist_reference);
+stub!(test_download_to_existing_file);
+stub!(test_get_file_name);
+stub!(test_download_but_file_is_unsaved);
+stub!(test_download_with_custom_processed_url);
+stub!(test_download_with_custom_cache_key);
+stub!(test_cache_garbage_collection_is_called);
+stub!(test_download_file_with_invalid_checksum);
+stub!(test_downgrade_shows_appropriate_message);
diff --git a/crates/shirabe/tests/downloader/git_downloader_test.rs b/crates/shirabe/tests/downloader/git_downloader_test.rs
index 3c30177..c332b5d 100644
--- a/crates/shirabe/tests/downloader/git_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/git_downloader_test.rs
@@ -1 +1,30 @@
//! ref: composer/tests/Composer/Test/Downloader/GitDownloaderTest.php
+
+// These construct a GitDownloader with a mocked IO/Config and a mocked ProcessExecutor to
+// feed git command output; mocking is not available, and a real HttpDownloader reaches
+// curl_multi_init (todo!()).
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_download_for_package_without_source_reference);
+stub!(test_download);
+stub!(test_download_with_cache);
+stub!(test_download_uses_various_protocols_and_sets_push_url_for_github);
+stub!(test_download_and_set_push_url_use_custom_various_protocols_for_github);
+stub!(test_download_throws_runtime_exception_if_git_command_fails);
+stub!(test_updatefor_package_without_source_reference);
+stub!(test_update);
+stub!(test_update_with_new_repo_url);
+stub!(test_update_throws_runtime_exception_if_git_command_fails);
+stub!(test_update_doesnt_throws_runtime_exception_if_git_command_fails_at_first_but_is_able_to_recover);
+stub!(test_downgrade_shows_appropriate_message);
+stub!(test_not_using_downgrading_with_references);
+stub!(test_remove);
+stub!(test_get_installation_source);
diff --git a/crates/shirabe/tests/downloader/main.rs b/crates/shirabe/tests/downloader/main.rs
index cf52ccd..6e39b85 100644
--- a/crates/shirabe/tests/downloader/main.rs
+++ b/crates/shirabe/tests/downloader/main.rs
@@ -1,5 +1,9 @@
mod archive_downloader_test;
+mod download_manager_test;
+mod file_downloader_test;
mod fossil_downloader_test;
+mod git_downloader_test;
mod hg_downloader_test;
mod perforce_downloader_test;
mod xz_downloader_test;
+mod zip_downloader_test;
diff --git a/crates/shirabe/tests/downloader/zip_downloader_test.rs b/crates/shirabe/tests/downloader/zip_downloader_test.rs
index 8b53dac..0c8657c 100644
--- a/crates/shirabe/tests/downloader/zip_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/zip_downloader_test.rs
@@ -1 +1,22 @@
//! ref: composer/tests/Composer/Test/Downloader/ZipDownloaderTest.php
+
+// These construct a ZipDownloader with a mocked IO/HttpDownloader/ProcessExecutor and rely
+// on ZipArchive extraction (todo!() in the php-shim) plus mocked unzip behaviour.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks IO/HttpDownloader/ProcessExecutor and uses ZipArchive (todo!())"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_error_messages);
+stub!(test_zip_archive_only_failed);
+stub!(test_zip_archive_extract_only_failed);
+stub!(test_zip_archive_only_good);
+stub!(test_system_unzip_only_failed);
+stub!(test_system_unzip_only_good);
+stub!(test_non_windows_fallback_good);
+stub!(test_non_windows_fallback_failed);
diff --git a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
index 1194da4..86e33f2 100644
--- a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
+++ b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
@@ -1 +1,30 @@
//! ref: composer/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
+
+// These build an EventDispatcher with a mocked Composer/IO/ProcessExecutor and run script
+// listeners (executing CLI/PHP callbacks); mocking and the script-execution machinery are
+// not available here.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks Composer/IO/ProcessExecutor and executes script listeners; not ported"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_listener_exceptions_are_caught);
+stub!(test_dispatcher_can_execute_single_command_line_script);
+stub!(test_dispatcher_pass_dev_mode_to_autoload_generator_for_script_events);
+stub!(test_dispatcher_remove_listener);
+stub!(test_dispatcher_can_execute_cli_and_php_in_same_event_script_stack);
+stub!(test_dispatcher_can_put_env);
+stub!(test_dispatcher_appends_dir_bin_on_path_for_every_listener);
+stub!(test_dispatcher_support_for_additional_args);
+stub!(test_dispatcher_can_execute_composer_script_groups);
+stub!(test_recursion_in_scripts_names);
+stub!(test_dispatcher_detect_infinite_recursion);
+stub!(test_dispatcher_outputs_command);
+stub!(test_dispatcher_outputs_error_on_failed_command);
+stub!(test_dispatcher_installer_events);
+stub!(test_dispatcher_doesnt_return_skipped_scripts);
diff --git a/crates/shirabe/tests/event_dispatcher/main.rs b/crates/shirabe/tests/event_dispatcher/main.rs
new file mode 100644
index 0000000..d5d096a
--- /dev/null
+++ b/crates/shirabe/tests/event_dispatcher/main.rs
@@ -0,0 +1 @@
+mod event_dispatcher_test;
diff --git a/crates/shirabe/tests/installed_versions_test.rs b/crates/shirabe/tests/installed_versions_test.rs
index 3173559..1357fd4 100644
--- a/crates/shirabe/tests/installed_versions_test.rs
+++ b/crates/shirabe/tests/installed_versions_test.rs
@@ -1 +1,28 @@
//! ref: composer/tests/Composer/Test/InstalledVersionsTest.php
+
+// setUpBeforeClass reflects into ClassLoader::registeredLoaders and the cases load
+// installed.php fixtures via InstalledVersions::reload; the reflection and fixture loading
+// are not ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "needs reflection into ClassLoader::registeredLoaders and installed.php fixtures (not ported)"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_get_installed_packages);
+stub!(test_is_installed);
+stub!(test_satisfies);
+stub!(test_get_version_ranges);
+stub!(test_get_version);
+stub!(test_get_pretty_version);
+stub!(test_get_version_out_of_bounds);
+stub!(test_get_root_package);
+stub!(test_get_raw_data);
+stub!(test_get_reference);
+stub!(test_get_installed_packages_by_type);
+stub!(test_get_install_path);
+stub!(test_with_class_loader_loaded);
diff --git a/crates/shirabe/tests/installer/installation_manager_test.rs b/crates/shirabe/tests/installer/installation_manager_test.rs
index 66d89ed..0ec4651 100644
--- a/crates/shirabe/tests/installer/installation_manager_test.rs
+++ b/crates/shirabe/tests/installer/installation_manager_test.rs
@@ -1 +1,22 @@
//! ref: composer/tests/Composer/Test/Installer/InstallationManagerTest.php
+
+// These mock individual installers, the repository and IO to drive InstallationManager's
+// add/execute/install/update/uninstall logic; mocking is not available here.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks installers/repository/IO to drive InstallationManager; mocking is not available"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_add_get_installer);
+stub!(test_add_remove_installer);
+stub!(test_execute);
+stub!(test_install);
+stub!(test_update_with_equal_types);
+stub!(test_update_with_not_equal_types);
+stub!(test_uninstall);
+stub!(test_install_binary);
diff --git a/crates/shirabe/tests/installer/library_installer_test.rs b/crates/shirabe/tests/installer/library_installer_test.rs
index e15a225..4f2e33e 100644
--- a/crates/shirabe/tests/installer/library_installer_test.rs
+++ b/crates/shirabe/tests/installer/library_installer_test.rs
@@ -1 +1,23 @@
//! ref: composer/tests/Composer/Test/Installer/LibraryInstallerTest.php
+
+// These construct a LibraryInstaller over a temp dir with a mocked IO/Filesystem/repository
+// and mocked packages to drive install/update/uninstall and path resolution.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks IO/Filesystem/repository and packages to drive LibraryInstaller; mocking is not available"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_installer_creation_should_not_create_vendor_directory);
+stub!(test_installer_creation_should_not_create_bin_directory);
+stub!(test_is_installed);
+stub!(test_install);
+stub!(test_update);
+stub!(test_uninstall);
+stub!(test_get_install_path_without_target_dir);
+stub!(test_get_install_path_with_target_dir);
+stub!(test_ensure_binaries_installed);
diff --git a/crates/shirabe/tests/installer/main.rs b/crates/shirabe/tests/installer/main.rs
index de72ceb..f5b8c32 100644
--- a/crates/shirabe/tests/installer/main.rs
+++ b/crates/shirabe/tests/installer/main.rs
@@ -2,5 +2,8 @@
mod test_case;
mod binary_installer_test;
+mod installation_manager_test;
mod installer_event_test;
+mod library_installer_test;
mod metapackage_installer_test;
+mod suggested_packages_reporter_test;
diff --git a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
index 4d672f6..f32b10c 100644
--- a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
+++ b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
@@ -1 +1,25 @@
//! ref: composer/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php
+
+// These construct a SuggestedPackagesReporter with a mocked IO and assert its accumulated
+// suggestions and formatted output; mocking is not available here.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks IO to drive SuggestedPackagesReporter output; mocking is not available"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_constructor);
+stub!(test_get_packages_empty_by_default);
+stub!(test_get_packages);
+stub!(test_add_package_appends);
+stub!(test_add_suggestions_from_package);
+stub!(test_output);
+stub!(test_output_with_no_suggestion_reason);
+stub!(test_output_ignores_formatting);
+stub!(test_output_multiple_packages);
+stub!(test_output_skip_installed_packages);
+stub!(test_output_not_getting_installed_packages_when_no_suggestions);
diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs
index 2376d47..c7d3a91 100644
--- a/crates/shirabe/tests/installer_test.rs
+++ b/crates/shirabe/tests/installer_test.rs
@@ -1 +1,19 @@
//! ref: composer/tests/Composer/Test/InstallerTest.php
+
+// These are large end-to-end installer integration cases driven by fixtures and a mocked
+// Composer/IO/repositories; the full install pipeline (and constraint parsing through a
+// look-around regex) is not ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "not yet ported (end-to-end Installer integration over fixtures; constraint parsing uses a look-around regex)"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_installer);
+stub!(test_slow_integration);
+stub!(test_integration_with_pool_optimizer);
+stub!(test_integration_with_raw_pool);
diff --git a/crates/shirabe/tests/io/console_io_test.rs b/crates/shirabe/tests/io/console_io_test.rs
index be2ce85..6715978 100644
--- a/crates/shirabe/tests/io/console_io_test.rs
+++ b/crates/shirabe/tests/io/console_io_test.rs
@@ -1 +1,27 @@
//! ref: composer/tests/Composer/Test/IO/ConsoleIOTest.php
+
+// These mock Symfony's InputInterface/OutputInterface/HelperSet (and QuestionHelper) to
+// drive ConsoleIO; those console abstractions are not ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "mocks Symfony Input/Output/HelperSet to drive ConsoleIO; not ported"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_is_interactive);
+stub!(test_write);
+stub!(test_write_error);
+stub!(test_write_with_multiple_line_string_when_debugging);
+stub!(test_overwrite);
+stub!(test_ask);
+stub!(test_ask_confirmation);
+stub!(test_ask_and_validate);
+stub!(test_select);
+stub!(test_set_and_get_authentication);
+stub!(test_get_authentication_when_did_not_set);
+stub!(test_has_authentication);
+stub!(test_sanitize);
diff --git a/crates/shirabe/tests/io/main.rs b/crates/shirabe/tests/io/main.rs
index 68d66a3..a3148fd 100644
--- a/crates/shirabe/tests/io/main.rs
+++ b/crates/shirabe/tests/io/main.rs
@@ -1,2 +1,3 @@
mod buffer_io_test;
+mod console_io_test;
mod null_io_test;
diff --git a/crates/shirabe/tests/json/composer_schema_test.rs b/crates/shirabe/tests/json/composer_schema_test.rs
index abf310f..044bec1 100644
--- a/crates/shirabe/tests/json/composer_schema_test.rs
+++ b/crates/shirabe/tests/json/composer_schema_test.rs
@@ -1 +1,19 @@
//! ref: composer/tests/Composer/Test/Json/ComposerSchemaTest.php
+
+// These validate documents against the bundled composer-schema.json via JsonFile's
+// json-schema validator, which is not ported.
+macro_rules! stub {
+ ($name:ident) => {
+ #[test]
+ #[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"]
+ fn $name() {
+ todo!()
+ }
+ };
+}
+
+stub!(test_name_pattern);
+stub!(test_version_pattern);
+stub!(test_optional_abandoned_property);
+stub!(test_require_types);
+stub!(test_minimum_stability_values);
diff --git a/crates/shirabe/tests/json/main.rs b/crates/shirabe/tests/json/main.rs
index 279b5b5..3034990 100644
--- a/crates/shirabe/tests/json/main.rs
+++ b/crates/shirabe/tests/json/main.rs
@@ -1,3 +1,4 @@
+mod composer_schema_test;
mod json_file_test;
mod json_manipulator_test;
mod json_formatter_test;