diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 04:30:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 04:30:31 +0900 |
| commit | d02e79c0cddd986a0b2cef878f32bda39cc2f5e9 (patch) | |
| tree | 43e2256ae239aa005d31bc9505a507b4d303ab17 /crates | |
| parent | d2babe9ed19a40dca2790b3eeaff0b0de9714451 (diff) | |
| download | php-shirabe-d02e79c0cddd986a0b2cef878f32bda39cc2f5e9.tar.gz php-shirabe-d02e79c0cddd986a0b2cef878f32bda39cc2f5e9.tar.zst php-shirabe-d02e79c0cddd986a0b2cef878f32bda39cc2f5e9.zip | |
test: port SecurityAdvisoryPoolFilter, downloader/command/app stubs
All ignored/todo!(): the advisory filter parses affectedVersions via a
look-around regex; the Hg/Fossil/Perforce/Archive downloaders and
RepositoryManager need mocked process/HttpDownloader (curl); the Validate/
Archive commands, ApplicationTest and CompletionFunctionalTest need the
ApplicationTester/console harness. setUp/tearDown not ported.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates')
19 files changed, 343 insertions, 15 deletions
diff --git a/crates/shirabe/tests/application_test.rs b/crates/shirabe/tests/application_test.rs index 5f3e07c..8251310 100644 --- a/crates/shirabe/tests/application_test.rs +++ b/crates/shirabe/tests/application_test.rs @@ -1 +1,34 @@ //! ref: composer/tests/Composer/Test/ApplicationTest.php + +// These drive the console Application (doRun, getDisplay, plugin disabling, command +// resolution) via ApplicationTester, none of which are ported. + +#[test] +#[ignore = "requires the console Application/ApplicationTester harness, which is not yet ported"] +fn test_dev_warning() { + todo!() +} + +#[test] +#[ignore = "requires the console Application/ApplicationTester harness, which is not yet ported"] +fn test_dev_warning_suppressed_for_self_update() { + todo!() +} + +#[test] +#[ignore = "requires the console Application/ApplicationTester harness, which is not yet ported"] +fn test_process_isolation_works_multiple_times() { + todo!() +} + +#[test] +#[ignore = "requires the console Application/ApplicationTester harness, which is not yet ported"] +fn test_no_plugins_disables_plugins_when_script_commands_exist() { + todo!() +} + +#[test] +#[ignore = "requires the console Application/ApplicationTester harness, which is not yet ported"] +fn test_script_command_takes_priority_over_abbreviated_builtin_command() { + todo!() +} diff --git a/crates/shirabe/tests/command/archive_command_test.rs b/crates/shirabe/tests/command/archive_command_test.rs index 79e0a8b..b716a3c 100644 --- a/crates/shirabe/tests/command/archive_command_test.rs +++ b/crates/shirabe/tests/command/archive_command_test.rs @@ -1 +1,19 @@ //! ref: composer/tests/Composer/Test/Command/ArchiveCommandTest.php + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_uses_config_from_composer_object() { + todo!() +} + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_uses_config_from_factory_when_composer_is_not_defined() { + todo!() +} + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_uses_config_from_composer_object_with_package_name() { + todo!() +} diff --git a/crates/shirabe/tests/command/main.rs b/crates/shirabe/tests/command/main.rs index 9183b33..5e3922c 100644 --- a/crates/shirabe/tests/command/main.rs +++ b/crates/shirabe/tests/command/main.rs @@ -1,4 +1,5 @@ mod about_command_test; +mod archive_command_test; mod audit_command_test; mod check_platform_reqs_command_test; mod clear_cache_command_test; @@ -9,3 +10,4 @@ mod reinstall_command_test; mod search_command_test; mod self_update_command_test; mod status_command_test; +mod validate_command_test; diff --git a/crates/shirabe/tests/command/validate_command_test.rs b/crates/shirabe/tests/command/validate_command_test.rs index 0d10cc5..26af2ae 100644 --- a/crates/shirabe/tests/command/validate_command_test.rs +++ b/crates/shirabe/tests/command/validate_command_test.rs @@ -1 +1,25 @@ //! ref: composer/tests/Composer/Test/Command/ValidateCommandTest.php + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_validate() { + todo!() +} + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_validate_on_file_issues() { + todo!() +} + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_with_composer_lock() { + todo!() +} + +#[test] +#[ignore = "requires the ApplicationTester/initTempComposer harness, which is not yet ported"] +fn test_unaccessible_file() { + todo!() +} diff --git a/crates/shirabe/tests/completion_functional_test.rs b/crates/shirabe/tests/completion_functional_test.rs index 9411721..9dc0482 100644 --- a/crates/shirabe/tests/completion_functional_test.rs +++ b/crates/shirabe/tests/completion_functional_test.rs @@ -1 +1,7 @@ //! ref: composer/tests/Composer/Test/CompletionFunctionalTest.php + +#[test] +#[ignore = "requires the console completion harness (Application + CompletionInput), which is not yet ported"] +fn test_complete() { + todo!() +} diff --git a/crates/shirabe/tests/dependency_resolver/main.rs b/crates/shirabe/tests/dependency_resolver/main.rs index a647604..80e587a 100644 --- a/crates/shirabe/tests/dependency_resolver/main.rs +++ b/crates/shirabe/tests/dependency_resolver/main.rs @@ -5,5 +5,6 @@ mod pool_test; mod request_test; mod rule_set_iterator_test; mod rule_set_test; +mod security_advisory_pool_filter_test; mod rule_test; mod transaction_test; diff --git a/crates/shirabe/tests/dependency_resolver/rule_test.rs b/crates/shirabe/tests/dependency_resolver/rule_test.rs index 31c525f..9806820 100644 --- a/crates/shirabe/tests/dependency_resolver/rule_test.rs +++ b/crates/shirabe/tests/dependency_resolver/rule_test.rs @@ -1,8 +1,6 @@ //! ref: composer/tests/Composer/Test/DependencyResolver/RuleTest.php -use shirabe::dependency_resolver::{ - GenericRule, RULE_ROOT_REQUIRE, ReasonData, Rule, RuleSet, -}; +use shirabe::dependency_resolver::{GenericRule, RULE_ROOT_REQUIRE, ReasonData, Rule, RuleSet}; use shirabe_semver::constraint::MatchAllConstraint; fn root_require_reason() -> ReasonData { @@ -13,7 +11,11 @@ fn root_require_reason() -> ReasonData { } fn generic_rule(literals: Vec<i64>) -> Rule { - Rule::Generic(GenericRule::new(literals, RULE_ROOT_REQUIRE, root_require_reason())) + Rule::Generic(GenericRule::new( + literals, + RULE_ROOT_REQUIRE, + root_require_reason(), + )) } #[test] diff --git a/crates/shirabe/tests/dependency_resolver/security_advisory_pool_filter_test.rs b/crates/shirabe/tests/dependency_resolver/security_advisory_pool_filter_test.rs index d002fd8..825d6b4 100644 --- a/crates/shirabe/tests/dependency_resolver/security_advisory_pool_filter_test.rs +++ b/crates/shirabe/tests/dependency_resolver/security_advisory_pool_filter_test.rs @@ -1 +1,30 @@ //! ref: composer/tests/Composer/Test/DependencyResolver/SecurityAdvisoryPoolFilterTest.php + +// The filter parses each advisory's affectedVersions (e.g. ">=1.0.0,<1.1.0") into a +// constraint, which goes through the version parser's look-around regex that the regex +// crate cannot compile. The fixtures also build PackageRepository security-advisory data +// and run the Auditor. + +#[test] +#[ignore = "filtering parses affectedVersions via a look-around regex the regex crate cannot compile"] +fn test_filter_packages_by_advisories() { + todo!() +} + +#[test] +#[ignore = "filtering parses affectedVersions via a look-around regex the regex crate cannot compile"] +fn test_dont_filter_packages_by_ignored_advisories() { + todo!() +} + +#[test] +#[ignore = "filtering parses affectedVersions via a look-around regex the regex crate cannot compile"] +fn test_dont_filter_packages_with_block_insecure_disabled() { + todo!() +} + +#[test] +#[ignore = "filtering parses affectedVersions via a look-around regex the regex crate cannot compile"] +fn test_dont_filter_packages_with_abandoned_package() { + todo!() +} diff --git a/crates/shirabe/tests/downloader/archive_downloader_test.rs b/crates/shirabe/tests/downloader/archive_downloader_test.rs index 54ac321..2c0e2de 100644 --- a/crates/shirabe/tests/downloader/archive_downloader_test.rs +++ b/crates/shirabe/tests/downloader/archive_downloader_test.rs @@ -1 +1,41 @@ //! ref: composer/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php + +// These exercise getFileName/processUrl on an anonymous ArchiveDownloader subclass built +// with a mocked IO and a real HttpDownloader (curl_multi_init is todo!()), and pass mocked +// packages. + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_get_file_name() { + todo!() +} + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_process_url() { + todo!() +} + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_process_url2() { + todo!() +} + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_process_url3() { + todo!() +} + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_process_url_rewrite_dist() { + todo!() +} + +#[test] +#[ignore = "constructs an ArchiveDownloader (HttpDownloader reaches curl_multi_init, todo!()) with a mocked subclass/package"] +fn test_process_url_rewrite_bitbucket_dist() { + todo!() +} diff --git a/crates/shirabe/tests/downloader/fossil_downloader_test.rs b/crates/shirabe/tests/downloader/fossil_downloader_test.rs index 827d634..89e0a9d 100644 --- a/crates/shirabe/tests/downloader/fossil_downloader_test.rs +++ b/crates/shirabe/tests/downloader/fossil_downloader_test.rs @@ -1 +1,41 @@ //! ref: composer/tests/Composer/Test/Downloader/FossilDownloaderTest.php + +// Every case constructs a FossilDownloader with a mocked IO/Config and a mocked +// ProcessExecutor to feed fossil command output; a real HttpDownloader reaches +// curl_multi_init (todo!()), and ProcessExecutor mocking is not available. + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_install_for_package_without_source_reference() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_install() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_updatefor_package_without_source_reference() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_update() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_remove() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_get_installation_source() { + todo!() +} diff --git a/crates/shirabe/tests/downloader/hg_downloader_test.rs b/crates/shirabe/tests/downloader/hg_downloader_test.rs index bf08c1a..23c09f9 100644 --- a/crates/shirabe/tests/downloader/hg_downloader_test.rs +++ b/crates/shirabe/tests/downloader/hg_downloader_test.rs @@ -1 +1,41 @@ //! ref: composer/tests/Composer/Test/Downloader/HgDownloaderTest.php + +// Every case constructs an HgDownloader with a mocked IO/Config and a mocked +// ProcessExecutor to feed hg command output; a real HttpDownloader reaches +// curl_multi_init (todo!()), and ProcessExecutor mocking is not available. + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_download_for_package_without_source_reference() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_download() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_updatefor_package_without_source_reference() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_update() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_remove() { + todo!() +} + +#[test] +#[ignore = "mocks ProcessExecutor/IO and needs an HttpDownloader (curl_multi_init todo!())"] +fn test_get_installation_source() { + todo!() +} diff --git a/crates/shirabe/tests/downloader/main.rs b/crates/shirabe/tests/downloader/main.rs index 97f2ee4..cf52ccd 100644 --- a/crates/shirabe/tests/downloader/main.rs +++ b/crates/shirabe/tests/downloader/main.rs @@ -1 +1,5 @@ +mod archive_downloader_test; +mod fossil_downloader_test; +mod hg_downloader_test; +mod perforce_downloader_test; mod xz_downloader_test; diff --git a/crates/shirabe/tests/downloader/perforce_downloader_test.rs b/crates/shirabe/tests/downloader/perforce_downloader_test.rs index 97f45ca..41ced48 100644 --- a/crates/shirabe/tests/downloader/perforce_downloader_test.rs +++ b/crates/shirabe/tests/downloader/perforce_downloader_test.rs @@ -1 +1,28 @@ //! ref: composer/tests/Composer/Test/Downloader/PerforceDownloaderTest.php + +// These mock Perforce, the repository config and a Package to drive PerforceDownloader's +// initialization and install paths; mocking is not available here. + +#[test] +#[ignore = "mocks Perforce/repository/Package; mocking is not available"] +fn test_init_perforce_instantiates_a_new_perforce_object() { + todo!() +} + +#[test] +#[ignore = "mocks Perforce/repository/Package; mocking is not available"] +fn test_init_perforce_does_nothing_if_perforce_already_set() { + todo!() +} + +#[test] +#[ignore = "mocks Perforce/repository/Package; mocking is not available"] +fn test_do_install_with_tag() { + todo!() +} + +#[test] +#[ignore = "mocks Perforce/repository/Package; mocking is not available"] +fn test_do_install_with_no_tag() { + todo!() +} diff --git a/crates/shirabe/tests/repository/filter_repository_test.rs b/crates/shirabe/tests/repository/filter_repository_test.rs index 1f8b64a..1074fb4 100644 --- a/crates/shirabe/tests/repository/filter_repository_test.rs +++ b/crates/shirabe/tests/repository/filter_repository_test.rs @@ -22,19 +22,31 @@ fn array_repo() -> RepositoryInterfaceHandle { RepositoryInterfaceHandle::new(repo) } -fn config(only: Option<&[&str]>, exclude: Option<&[&str]>) -> IndexMap<String, shirabe_php_shim::PhpMixed> { +fn config( + only: Option<&[&str]>, + exclude: Option<&[&str]>, +) -> IndexMap<String, shirabe_php_shim::PhpMixed> { use shirabe_php_shim::PhpMixed; let mut c: IndexMap<String, PhpMixed> = IndexMap::new(); if let Some(only) = only { c.insert( "only".to_string(), - PhpMixed::List(only.iter().map(|s| PhpMixed::String(s.to_string())).collect()), + PhpMixed::List( + only.iter() + .map(|s| PhpMixed::String(s.to_string())) + .collect(), + ), ); } if let Some(exclude) = exclude { c.insert( "exclude".to_string(), - PhpMixed::List(exclude.iter().map(|s| PhpMixed::String(s.to_string())).collect()), + PhpMixed::List( + exclude + .iter() + .map(|s| PhpMixed::String(s.to_string())) + .collect(), + ), ); } c @@ -45,7 +57,10 @@ fn match_all() -> AnyConstraint { } fn stabilities() -> IndexMap<String, i64> { - STABILITIES.iter().map(|(k, v)| (k.to_string(), *v)).collect() + STABILITIES + .iter() + .map(|(k, v)| (k.to_string(), *v)) + .collect() } #[test] diff --git a/crates/shirabe/tests/repository/main.rs b/crates/shirabe/tests/repository/main.rs index 9884b3f..4cbaf2e 100644 --- a/crates/shirabe/tests/repository/main.rs +++ b/crates/shirabe/tests/repository/main.rs @@ -7,5 +7,6 @@ mod composite_repository_test; mod filter_repository_test; mod installed_repository_test; mod repository_factory_test; +mod repository_manager_test; mod repository_utils_test; mod vcs; diff --git a/crates/shirabe/tests/repository/repository_factory_test.rs b/crates/shirabe/tests/repository/repository_factory_test.rs index 8871f91..98e2c85 100644 --- a/crates/shirabe/tests/repository/repository_factory_test.rs +++ b/crates/shirabe/tests/repository/repository_factory_test.rs @@ -60,8 +60,10 @@ fn test_generate_repository_name() { .into_iter() .map(|(k, v)| (k.to_string(), v)) .collect(); - let existing_repos: IndexMap<String, ()> = - existing_keys.into_iter().map(|k| (k.to_string(), ())).collect(); + let existing_repos: IndexMap<String, ()> = existing_keys + .into_iter() + .map(|k| (k.to_string(), ())) + .collect(); assert_eq!( expected, diff --git a/crates/shirabe/tests/repository/repository_manager_test.rs b/crates/shirabe/tests/repository/repository_manager_test.rs index 6af58e8..60deb7e 100644 --- a/crates/shirabe/tests/repository/repository_manager_test.rs +++ b/crates/shirabe/tests/repository/repository_manager_test.rs @@ -1 +1,29 @@ //! ref: composer/tests/Composer/Test/Repository/RepositoryManagerTest.php + +// These construct a RepositoryManager (which builds an HttpDownloader reaching +// curl_multi_init, todo!()) with a mocked IO/Config/EventDispatcher and exercise repo +// creation/prepending/wrapping. + +#[test] +#[ignore = "RepositoryManager::new builds an HttpDownloader (curl_multi_init todo!()) and mocks IO/Config"] +fn test_prepend() { + todo!() +} + +#[test] +#[ignore = "RepositoryManager::new builds an HttpDownloader (curl_multi_init todo!()) and mocks IO/Config"] +fn test_repo_creation() { + todo!() +} + +#[test] +#[ignore = "RepositoryManager::new builds an HttpDownloader (curl_multi_init todo!()) and mocks IO/Config"] +fn test_invalid_repo_creation_throws() { + todo!() +} + +#[test] +#[ignore = "RepositoryManager::new builds an HttpDownloader (curl_multi_init todo!()) and mocks IO/Config"] +fn test_filter_repo_wrapping() { + todo!() +} diff --git a/crates/shirabe/tests/repository/repository_utils_test.rs b/crates/shirabe/tests/repository/repository_utils_test.rs index e892af7..3f55bfd 100644 --- a/crates/shirabe/tests/repository/repository_utils_test.rs +++ b/crates/shirabe/tests/repository/repository_utils_test.rs @@ -107,7 +107,12 @@ fn provide_filter_require_tests() -> Vec<FilterCase> { }, // 'simple require' FilterCase { - requirer: load_with("requirer/pkg", "1.0.0", "require", vec![("required/a", "*")]), + requirer: load_with( + "requirer/pkg", + "1.0.0", + "require", + vec![("required/a", "*")], + ), expected: vec!["a"], include_require_dev: false, }, @@ -124,7 +129,12 @@ fn provide_filter_require_tests() -> Vec<FilterCase> { }, // 'require transitive deps and aliases are included' FilterCase { - requirer: load_with("requirer/pkg", "1.0.0", "require", vec![("required/b", "*")]), + requirer: load_with( + "requirer/pkg", + "1.0.0", + "require", + vec![("required/b", "*")], + ), expected: vec!["b", "c", "c-alias"], include_require_dev: false, }, @@ -148,8 +158,11 @@ fn test_filter_required_packages() { for case in provide_filter_require_tests() { let pkgs = build_packages(); let packages: Vec<PackageInterfaceHandle> = pkgs.values().cloned().collect(); - let expected: Vec<PackageInterfaceHandle> = - case.expected.iter().map(|name| pkgs[*name].clone()).collect(); + let expected: Vec<PackageInterfaceHandle> = case + .expected + .iter() + .map(|name| pkgs[*name].clone()) + .collect(); let result = RepositoryUtils::filter_required_packages( &packages, diff --git a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs index 18bd7a0..e677b3d 100644 --- a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs +++ b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs @@ -11,7 +11,10 @@ use shirabe::repository::vcs::FossilDriver; fn support_provider() -> Vec<(&'static str, bool)> { vec![ ("http://fossil.kd2.org/kd2fw/", true), - ("https://chiselapp.com/user/rkeene/repository/flint/index", true), + ( + "https://chiselapp.com/user/rkeene/repository/flint/index", + true, + ), ("ssh://fossil.kd2.org/kd2fw.fossil", true), ] } |
