diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 05:13:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 05:13:03 +0900 |
| commit | 3efcd8d338aa49efb0c9075c0f7a4dd4e4138b7d (patch) | |
| tree | b18aeb4b6b98ea2c74450b8c38e99c7607bd66c0 /crates/shirabe | |
| parent | 25f96cab45f5da4fba2ef0486a0b0bc8f7ca87b0 (diff) | |
| download | php-shirabe-3efcd8d338aa49efb0c9075c0f7a4dd4e4138b7d.tar.gz php-shirabe-3efcd8d338aa49efb0c9075c0f7a4dd4e4138b7d.tar.zst php-shirabe-3efcd8d338aa49efb0c9075c0f7a4dd4e4138b7d.zip | |
test: port package archiver/loader/version/locker and PluginInstaller stubs
All ignored: ArrayLoader/ValidatingArrayLoader/VersionSelector parse
constraints via a look-around regex; ArchiveManager uses PharData (todo!());
ArchivableFilesFinder/VersionGuesser/Locker mock git/process/IO; the plugin API
is not implemented (TODO(plugin)). Wires up the plugin test target.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe')
13 files changed, 203 insertions, 0 deletions
diff --git a/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs b/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs index 7513284..381c032 100644 --- a/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs +++ b/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs @@ -1 +1,17 @@ //! ref: composer/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php + +// These set up a temp directory tree (including a git repo) and assert the files the finder +// selects with manual/git/skip excludes; the git-backed fixture setup is not ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "needs a temp directory tree and git-backed fixtures to drive ArchivableFilesFinder; not ported"] + fn $name() { + todo!() + } + }; +} + +stub!(test_manual_excludes); +stub!(test_git_excludes); +stub!(test_skip_excludes); diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs index c4c9775..5f9e413 100644 --- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs +++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs @@ -1 +1,20 @@ //! ref: composer/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php + +// These drive ArchiveManager end-to-end (building tar archives via PharData, todo!()) and +// the filename-derivation helpers over packages; the archiving and fixture setup are not +// ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "ArchiveManager builds archives via PharData (todo!()) over fixtures; not ported"] + fn $name() { + todo!() + } + }; +} + +stub!(test_unknown_format); +stub!(test_archive_tar); +stub!(test_archive_custom_file_name); +stub!(test_get_package_filename_parts); +stub!(test_get_package_filename); diff --git a/crates/shirabe/tests/package/archiver/mod.rs b/crates/shirabe/tests/package/archiver/mod.rs index c1c93c4..1a4de3f 100644 --- a/crates/shirabe/tests/package/archiver/mod.rs +++ b/crates/shirabe/tests/package/archiver/mod.rs @@ -1,3 +1,5 @@ +mod archivable_files_finder_test; +mod archive_manager_test; mod git_exclude_filter_test; mod phar_archiver_test; mod zip_archiver_test; diff --git a/crates/shirabe/tests/package/loader/array_loader_test.rs b/crates/shirabe/tests/package/loader/array_loader_test.rs index a241722..fce85a7 100644 --- a/crates/shirabe/tests/package/loader/array_loader_test.rs +++ b/crates/shirabe/tests/package/loader/array_loader_test.rs @@ -1 +1,37 @@ //! ref: composer/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php + +// ArrayLoader::load parses version/link constraints through a look-around regex the regex +// crate cannot compile. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "ArrayLoader::load parses constraints via a look-around regex the regex crate cannot compile"] + fn $name() { + todo!() + } + }; +} + +stub!(test_self_version); +stub!(test_type_default); +stub!(test_normalized_version_optimization); +stub!(test_parse_dump_default_load_config); +stub!(test_parse_dump_true_load_config); +stub!(test_parse_dump_false_load_config); +stub!(test_package_with_branch_alias); +stub!(test_package_aliasing_without_branch_alias); +stub!(test_abandoned); +stub!(test_not_abandoned); +stub!(test_plugin_api_version_are_kept_as_declared); +stub!(test_plugin_api_version_does_support_self_version); +stub!(test_parse_links_integer_target); +stub!(test_parse_links_invalid_version); +stub!(test_none_string_version); +stub!(test_none_string_source_dist_reference); +stub!(test_branch_alias_integer_index); +stub!(test_package_links_require); +stub!(test_package_links_require_invalid); +stub!(test_package_links_replace); +stub!(test_package_links_replace_invalid); +stub!(test_support_string_value); +stub!(test_invalid_version); diff --git a/crates/shirabe/tests/package/loader/mod.rs b/crates/shirabe/tests/package/loader/mod.rs index 7890044..c60c27a 100644 --- a/crates/shirabe/tests/package/loader/mod.rs +++ b/crates/shirabe/tests/package/loader/mod.rs @@ -1 +1,3 @@ +mod array_loader_test; mod root_package_loader_test; +mod validating_array_loader_test; diff --git a/crates/shirabe/tests/package/loader/validating_array_loader_test.rs b/crates/shirabe/tests/package/loader/validating_array_loader_test.rs index b974397..6e4425d 100644 --- a/crates/shirabe/tests/package/loader/validating_array_loader_test.rs +++ b/crates/shirabe/tests/package/loader/validating_array_loader_test.rs @@ -1 +1,18 @@ //! ref: composer/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php + +// ValidatingArrayLoader wraps ArrayLoader, whose constraint parsing uses a look-around +// regex the regex crate cannot compile; the success/warning data sets are large. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "ValidatingArrayLoader -> ArrayLoader parses constraints via a look-around regex the regex crate cannot compile"] + fn $name() { + todo!() + } + }; +} + +stub!(test_load_success); +stub!(test_load_failure_throws_exception); +stub!(test_load_warnings); +stub!(test_load_skips_warning_data_when_ignoring_errors); diff --git a/crates/shirabe/tests/package/locker_test.rs b/crates/shirabe/tests/package/locker_test.rs index 6bfc8bc..4023c10 100644 --- a/crates/shirabe/tests/package/locker_test.rs +++ b/crates/shirabe/tests/package/locker_test.rs @@ -1 +1,25 @@ //! ref: composer/tests/Composer/Test/Package/LockerTest.php + +// These construct a Locker with a mocked JsonFile/InstallationManager/repository and a +// mocked ProcessExecutor to drive lock read/write and freshness checks; mocking is not +// available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks JsonFile/InstallationManager/repository/ProcessExecutor to drive Locker; mocking is not available"] + fn $name() { + todo!() + } + }; +} + +stub!(test_is_locked); +stub!(test_get_not_locked_packages); +stub!(test_get_locked_packages); +stub!(test_set_lock_data); +stub!(test_lock_bad_packages); +stub!(test_is_fresh); +stub!(test_is_fresh_false); +stub!(test_is_fresh_with_content_hash); +stub!(test_is_fresh_with_content_hash_and_no_hash); +stub!(test_is_fresh_false_with_content_hash); diff --git a/crates/shirabe/tests/package/main.rs b/crates/shirabe/tests/package/main.rs index d3e91ab..57d7cd3 100644 --- a/crates/shirabe/tests/package/main.rs +++ b/crates/shirabe/tests/package/main.rs @@ -6,5 +6,6 @@ mod base_package_test; mod complete_package_test; mod dumper; mod loader; +mod locker_test; mod root_alias_package_test; mod version; diff --git a/crates/shirabe/tests/package/version/mod.rs b/crates/shirabe/tests/package/version/mod.rs index 1a5d73d..4b40290 100644 --- a/crates/shirabe/tests/package/version/mod.rs +++ b/crates/shirabe/tests/package/version/mod.rs @@ -1,2 +1,4 @@ mod version_bumper_test; +mod version_guesser_test; mod version_parser_test; +mod version_selector_test; diff --git a/crates/shirabe/tests/package/version/version_guesser_test.rs b/crates/shirabe/tests/package/version/version_guesser_test.rs index 4f91b89..17a1a05 100644 --- a/crates/shirabe/tests/package/version/version_guesser_test.rs +++ b/crates/shirabe/tests/package/version/version_guesser_test.rs @@ -1 +1,29 @@ //! ref: composer/tests/Composer/Test/Package/Version/VersionGuesserTest.php + +// These drive VersionGuesser with a mocked ProcessExecutor feeding git/hg command output; +// mocking is not available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks a ProcessExecutor feeding git/hg output to drive VersionGuesser; mocking is not available"] + fn $name() { + todo!() + } + }; +} + +stub!(test_hg_guess_version_returns_data); +stub!(test_guess_version_returns_data); +stub!(test_guess_version_does_not_see_custom_default_branch_as_non_feature_branch); +stub!(test_guess_version_reads_and_respects_non_feature_branches_configuration_for_arbitrary_naming); +stub!(test_guess_version_reads_and_respects_non_feature_branches_configuration_for_arbitrary_naming_regex); +stub!(test_guess_version_reads_and_respects_non_feature_branches_configuration_for_arbitrary_naming_when_on_non_feature_branch); +stub!(test_detached_head_becomes_dev_hash); +stub!(test_detached_fetch_head_becomes_dev_hash_git2); +stub!(test_detached_commit_head_becomes_dev_hash_git2); +stub!(test_tag_becomes_version); +stub!(test_tag_becomes_pretty_version); +stub!(test_invalid_tag_becomes_version); +stub!(test_numeric_branches_show_nicely); +stub!(test_remote_branches_are_selected); +stub!(test_get_root_version_from_env); diff --git a/crates/shirabe/tests/package/version/version_selector_test.rs b/crates/shirabe/tests/package/version/version_selector_test.rs index a97ae4b..ccd64ad 100644 --- a/crates/shirabe/tests/package/version/version_selector_test.rs +++ b/crates/shirabe/tests/package/version/version_selector_test.rs @@ -1 +1,27 @@ //! ref: composer/tests/Composer/Test/Package/Version/VersionSelectorTest.php + +// VersionSelector ranks candidate packages whose versions/constraints are parsed through a +// look-around regex the regex crate cannot compile; the setup also mocks a repository. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "not yet ported (VersionSelector over a mocked repository; constraint parsing uses a look-around regex)"] + fn $name() { + todo!() + } + }; +} + +stub!(test_latest_version_is_returned); +stub!(test_latest_version_is_returned_that_matches_php_requirements); +stub!(test_latest_version_is_returned_that_matches_ext_requirements); +stub!(test_latest_version_is_returned_that_matches_platform_ext); +stub!(test_latest_version_is_returned_that_matches_composer_requirements); +stub!(test_most_stable_version_is_returned); +stub!(test_most_stable_version_is_returned_regardless_of_order); +stub!(test_highest_version_is_returned); +stub!(test_highest_version_matching_stability_is_returned); +stub!(test_most_stable_unstable_version_is_returned); +stub!(test_default_branch_alias_is_never_returned); +stub!(test_false_returned_on_no_packages); +stub!(test_find_recommended_require_version); diff --git a/crates/shirabe/tests/plugin/main.rs b/crates/shirabe/tests/plugin/main.rs new file mode 100644 index 0000000..4470522 --- /dev/null +++ b/crates/shirabe/tests/plugin/main.rs @@ -0,0 +1 @@ +mod plugin_installer_test; diff --git a/crates/shirabe/tests/plugin/plugin_installer_test.rs b/crates/shirabe/tests/plugin/plugin_installer_test.rs index 767a478..4fed7c6 100644 --- a/crates/shirabe/tests/plugin/plugin_installer_test.rs +++ b/crates/shirabe/tests/plugin/plugin_installer_test.rs @@ -1 +1,30 @@ //! ref: composer/tests/Composer/Test/Plugin/PluginInstallerTest.php + +// The plugin system requires the PHP runtime to load and instantiate plugin classes; the +// PluginManager/PluginInstaller is intentionally not implemented yet (TODO(plugin)). +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "the plugin API (PluginManager/PluginInstaller loading PHP plugin classes) is not implemented yet"] + fn $name() { + todo!() + } + }; +} + +stub!(test_install_new_plugin); +stub!(test_install_plugin_with_root_package_having_files_autoload); +stub!(test_install_multiple_plugins); +stub!(test_upgrade_with_new_class_name); +stub!(test_uninstall); +stub!(test_upgrade_with_same_class_name); +stub!(test_register_plugin_only_one_time); +stub!(test_star_plugin_version_works_with_any_api_version); +stub!(test_plugin_constraint_works_only_with_certain_api_version); +stub!(test_plugin_range_constraints_work_only_with_certain_api_version); +stub!(test_command_provider_capability); +stub!(test_incapable_plugin_is_correctly_detected); +stub!(test_capability_implements_composer_plugin_api_class_and_is_constructed_with_args); +stub!(test_querying_with_invalid_capability_class_name_throws); +stub!(test_querying_non_provided_capability_returns_null_safely); +stub!(test_querying_with_non_existing_or_wrong_capability_class_types_throws); |
