diff options
28 files changed, 434 insertions, 30 deletions
diff --git a/crates/shirabe/tests/composer_test.rs b/crates/shirabe/tests/composer_test.rs index bd417e9..75a554c 100644 --- a/crates/shirabe/tests/composer_test.rs +++ b/crates/shirabe/tests/composer_test.rs @@ -14,8 +14,8 @@ use shirabe::json::JsonFile; use shirabe::package::{Locker, RootPackageHandle, RootPackageInterfaceHandle}; use shirabe::repository::RepositoryManager; use shirabe::util::http_downloader::HttpDownloader; -use shirabe::util::process_executor::ProcessExecutor; use shirabe::util::r#loop::Loop; +use shirabe::util::process_executor::ProcessExecutor; fn null_io() -> Rc<RefCell<dyn IOInterface>> { Rc::new(RefCell::new(NullIO::new())) @@ -43,9 +43,12 @@ fn installation_manager(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<Install #[test] fn test_set_get_package() { let mut composer = Composer::new(); - let package: RootPackageInterfaceHandle = - RootPackageHandle::new("foo".to_string(), "1.0.0.0".to_string(), "1.0.0".to_string()) - .into(); + let package: RootPackageInterfaceHandle = RootPackageHandle::new( + "foo".to_string(), + "1.0.0.0".to_string(), + "1.0.0".to_string(), + ) + .into(); composer.set_package(package.clone()); assert!(composer.get_package().ptr_eq(&package)); diff --git a/crates/shirabe/tests/config_test.rs b/crates/shirabe/tests/config_test.rs index 0b88c6b..f44b746 100644 --- a/crates/shirabe/tests/config_test.rs +++ b/crates/shirabe/tests/config_test.rs @@ -12,10 +12,7 @@ fn repo(r#type: &str, url: &str) -> PhpMixed { } fn map(pairs: Vec<(&str, PhpMixed)>) -> IndexMap<String, PhpMixed> { - pairs - .into_iter() - .map(|(k, v)| (k.to_string(), v)) - .collect() + pairs.into_iter().map(|(k, v)| (k.to_string(), v)).collect() } fn disable(name: &str) -> PhpMixed { @@ -73,7 +70,10 @@ fn data_add_packagist_repository() -> Vec<Case> { ("packagist.org", packagist()), ]), local: map(vec![]), - system: Some(map(vec![("example.com", repo("composer", "http://example.com"))])), + system: Some(map(vec![( + "example.com", + repo("composer", "http://example.com"), + )])), }, // local config can disable repos by name and re-add them anonymously to bring them above system config Case { @@ -85,7 +85,10 @@ fn data_add_packagist_repository() -> Vec<Case> { ("0", disable("packagist.org")), ("1", repo("composer", "http://packagist.org")), ]), - system: Some(map(vec![("example.com", repo("composer", "http://example.com"))])), + system: Some(map(vec![( + "example.com", + repo("composer", "http://example.com"), + )])), }, // local config can override by name to bring a repo above system config Case { @@ -93,8 +96,14 @@ fn data_add_packagist_repository() -> Vec<Case> { ("packagist.org", repo("composer", "http://packagistnew.org")), ("example.com", repo("composer", "http://example.com")), ]), - local: map(vec![("packagist.org", repo("composer", "http://packagistnew.org"))]), - system: Some(map(vec![("example.com", repo("composer", "http://example.com"))])), + local: map(vec![( + "packagist.org", + repo("composer", "http://packagistnew.org"), + )]), + system: Some(map(vec![( + "example.com", + repo("composer", "http://example.com"), + )])), }, // local config redefining packagist.org by URL override it if no named keys are used Case { @@ -104,8 +113,14 @@ fn data_add_packagist_repository() -> Vec<Case> { }, // local config redefining packagist.org by URL override it also with named keys Case { - expected: map(vec![("example", repo("composer", "https://repo.packagist.org"))]), - local: map(vec![("example", repo("composer", "https://repo.packagist.org"))]), + expected: map(vec![( + "example", + repo("composer", "https://repo.packagist.org"), + )]), + local: map(vec![( + "example", + repo("composer", "https://repo.packagist.org"), + )]), system: None, }, // incorrect local config does not cause ErrorException diff --git a/crates/shirabe/tests/dependency_resolver/main.rs b/crates/shirabe/tests/dependency_resolver/main.rs index 47f381d..7a129ef 100644 --- a/crates/shirabe/tests/dependency_resolver/main.rs +++ b/crates/shirabe/tests/dependency_resolver/main.rs @@ -8,7 +8,7 @@ mod pool_test; mod request_test; mod rule_set_iterator_test; mod rule_set_test; +mod rule_test; mod security_advisory_pool_filter_test; mod solver_test; -mod rule_test; mod transaction_test; diff --git a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs index 9d6e88c..5620b2a 100644 --- a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs +++ b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs @@ -48,12 +48,22 @@ fn test_add() { let learned0 = learned_rule(); let mut rule_set = RuleSet::new(); - rule_set.add(request0.clone(), RuleSet::TYPE_REQUEST).unwrap(); - rule_set.add(learned0.clone(), RuleSet::TYPE_LEARNED).unwrap(); - rule_set.add(request1.clone(), RuleSet::TYPE_REQUEST).unwrap(); + rule_set + .add(request0.clone(), RuleSet::TYPE_REQUEST) + .unwrap(); + rule_set + .add(learned0.clone(), RuleSet::TYPE_LEARNED) + .unwrap(); + rule_set + .add(request1.clone(), RuleSet::TYPE_REQUEST) + .unwrap(); let rules = rule_set.get_rules(); - assert!(rules.get(&RuleSet::TYPE_PACKAGE).is_none_or(|v| v.is_empty())); + assert!( + rules + .get(&RuleSet::TYPE_PACKAGE) + .is_none_or(|v| v.is_empty()) + ); let request = &rules[&RuleSet::TYPE_REQUEST]; assert_eq!(2, request.len()); assert!(Rc::ptr_eq(&request[0], &request0)); diff --git a/crates/shirabe/tests/filter/platform_requirement_filter/ignore_list_platform_requirement_filter_test.rs b/crates/shirabe/tests/filter/platform_requirement_filter/ignore_list_platform_requirement_filter_test.rs index 4987d3f..b3a8403 100644 --- a/crates/shirabe/tests/filter/platform_requirement_filter/ignore_list_platform_requirement_filter_test.rs +++ b/crates/shirabe/tests/filter/platform_requirement_filter/ignore_list_platform_requirement_filter_test.rs @@ -23,7 +23,11 @@ fn data_is_ignored() -> Vec<(Vec<&'static str>, &'static str, bool)> { // 'php is not ignored if not listed' (vec!["ext-json", "monolog/monolog"], "php", false), // 'monolog/monolog is not ignored even if listed' - (vec!["ext-json", "monolog/monolog"], "monolog/monolog", false), + ( + vec!["ext-json", "monolog/monolog"], + "monolog/monolog", + false, + ), // 'ext-json is ignored if ext-* is listed' (vec!["ext-*"], "ext-json", true), // 'php is ignored if php* is listed' diff --git a/crates/shirabe/tests/json/main.rs b/crates/shirabe/tests/json/main.rs index 3034990..a5a01c8 100644 --- a/crates/shirabe/tests/json/main.rs +++ b/crates/shirabe/tests/json/main.rs @@ -1,5 +1,5 @@ mod composer_schema_test; mod json_file_test; -mod json_manipulator_test; mod json_formatter_test; +mod json_manipulator_test; mod json_validation_exception_test; diff --git a/crates/shirabe/tests/package/dumper/array_dumper_test.rs b/crates/shirabe/tests/package/dumper/array_dumper_test.rs index ae13679..c89f5ed 100644 --- a/crates/shirabe/tests/package/dumper/array_dumper_test.rs +++ b/crates/shirabe/tests/package/dumper/array_dumper_test.rs @@ -21,7 +21,10 @@ fn test_required_information() { let config = ArrayDumper::new().dump(complete_package().into()); let mut expected: IndexMap<String, PhpMixed> = IndexMap::new(); - expected.insert("name".to_string(), PhpMixed::String("dummy/pkg".to_string())); + expected.insert( + "name".to_string(), + PhpMixed::String("dummy/pkg".to_string()), + ); expected.insert("version".to_string(), PhpMixed::String("1.0.0".to_string())); expected.insert( "version_normalized".to_string(), diff --git a/crates/shirabe/tests/package/version/version_guesser_test.rs b/crates/shirabe/tests/package/version/version_guesser_test.rs index 17a1a05..ef4b232 100644 --- a/crates/shirabe/tests/package/version/version_guesser_test.rs +++ b/crates/shirabe/tests/package/version/version_guesser_test.rs @@ -15,7 +15,9 @@ macro_rules! stub { 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 +); 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); 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!() +} diff --git a/crates/shirabe/tests/script/event_test.rs b/crates/shirabe/tests/script/event_test.rs index 424f553..e2aab3c 100644 --- a/crates/shirabe/tests/script/event_test.rs +++ b/crates/shirabe/tests/script/event_test.rs @@ -17,9 +17,12 @@ fn create_composer_instance() -> ComposerHandle { ComposerHandle::from_rc_unchecked(Rc::new(RefCell::new(PartialOrFullComposer::new_full()))); let config = Rc::new(RefCell::new(Config::new(true, None))); composer.borrow_mut().set_config(config); - let package: RootPackageInterfaceHandle = - RootPackageHandle::new("foo".to_string(), "1.0.0.0".to_string(), "1.0.0".to_string()) - .into(); + let package: RootPackageInterfaceHandle = RootPackageHandle::new( + "foo".to_string(), + "1.0.0.0".to_string(), + "1.0.0".to_string(), + ) + .into(); composer.borrow_mut().set_package(package); composer } @@ -30,8 +33,7 @@ fn test_event_sets_originating_event() { let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new())); let composer = create_composer_instance(); - let originating_event = - BaseEvent::new("originatingEvent".to_string(), vec![], IndexMap::new()); + let originating_event = BaseEvent::new("originatingEvent".to_string(), vec![], IndexMap::new()); let mut script_event = Event::new( "test".to_string(), diff --git a/crates/shirabe/tests/util/auth_helper_test.rs b/crates/shirabe/tests/util/auth_helper_test.rs index 9ff7446..ebdd1f1 100644 --- a/crates/shirabe/tests/util/auth_helper_test.rs +++ b/crates/shirabe/tests/util/auth_helper_test.rs @@ -1 +1,34 @@ //! ref: composer/tests/Composer/Test/Util/AuthHelperTest.php + +// These mock IO/Config to drive AuthHelper's header/option building and interactive auth +// storage; mocking is not available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/Config to drive AuthHelper; mocking is not available"] + fn $name() { + todo!() + } + }; +} + +stub!(test_add_authentication_header_without_auth_credentials); +stub!(test_add_authentication_header_with_bearer_password); +stub!(test_add_authentication_header_with_github_token); +stub!(test_add_authentication_header_with_gitlab_oath_token); +stub!(test_add_authentication_options_for_client_certificate); +stub!(test_add_authentication_header_with_gitlab_private_token); +stub!(test_add_authentication_header_with_bitbucket_oath_token); +stub!(test_add_authentication_header_with_bitbucket_public_url); +stub!(test_add_authentication_header_with_basic_http_authentication); +stub!(test_add_authentication_header_with_custom_headers); +stub!(test_is_public_bit_bucket_download_with_bitbucket_public_url); +stub!(test_is_public_bit_bucket_download_with_non_bitbucket_public_url); +stub!(test_store_auth_automatically); +stub!(test_store_auth_with_prompt_yes_answer); +stub!(test_store_auth_with_prompt_no_answer); +stub!(test_store_auth_with_prompt_invalid_answer); +stub!(test_prompt_auth_if_needed_git_lab_no_auth_change); +stub!(test_prompt_auth_if_needed_multiple_bitbucket_downloads); +stub!(test_add_authentication_header_is_working); +stub!(test_add_authentication_header_deprecation); diff --git a/crates/shirabe/tests/util/bitbucket_test.rs b/crates/shirabe/tests/util/bitbucket_test.rs index 43cd2a4..2eb015a 100644 --- a/crates/shirabe/tests/util/bitbucket_test.rs +++ b/crates/shirabe/tests/util/bitbucket_test.rs @@ -1 +1,29 @@ //! ref: composer/tests/Composer/Test/Util/BitbucketTest.php + +// These mock IO/Config/HttpDownloader to drive Bitbucket's OAuth/access-token flow; mocking +// is not available and a real HttpDownloader reaches curl_multi_init (todo!()). +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/Config/HttpDownloader (curl_multi_init todo!()) for the Bitbucket OAuth flow"] + fn $name() { + todo!() + } + }; +} + +stub!(test_request_access_token_with_valid_oauth_consumer); +stub!(test_request_access_token_with_valid_oauth_consumer_and_valid_stored_access_token); +stub!(test_request_access_token_with_valid_oauth_consumer_and_expired_access_token); +stub!(test_request_access_token_with_username_and_password); +stub!(test_request_access_token_with_username_and_password_with_unauthorized_response); +stub!(test_request_access_token_with_username_and_password_with_not_found_response); +stub!(test_username_password_authentication_flow); +stub!(test_authorize_oauth_interactively_with_empty_username); +stub!(test_authorize_oauth_interactively_with_empty_password); +stub!(test_authorize_oauth_interactively_with_request_access_token_failure); +stub!(test_get_token_without_access_token); +stub!(test_get_token_with_access_token); +stub!(test_authorize_oauth_with_wrong_origin_url); +stub!(test_authorize_oauth_without_available_git_config_token); +stub!(test_authorize_oauth_with_available_git_config_token); diff --git a/crates/shirabe/tests/util/filesystem_test.rs b/crates/shirabe/tests/util/filesystem_test.rs index 16ffd3c..4ed9c14 100644 --- a/crates/shirabe/tests/util/filesystem_test.rs +++ b/crates/shirabe/tests/util/filesystem_test.rs @@ -1 +1,27 @@ //! ref: composer/tests/Composer/Test/Util/FilesystemTest.php + +// These exercise Filesystem path helpers and on-disk operations (sizes, copy, symlinks and +// junctions over a temp tree). The filesystem fixtures and platform-specific symlink/junction +// behaviour are not ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"] + fn $name() { + todo!() + } + }; +} + +stub!(test_find_shortest_path_code); +stub!(test_find_shortest_path); +stub!(test_remove_directory_php); +stub!(test_file_size); +stub!(test_directory_size); +stub!(test_normalize_path); +stub!(test_unlink_symlinked_directory); +stub!(test_remove_symlinked_directory_with_trailing_slash); +stub!(test_junctions); +stub!(test_override_junctions); +stub!(test_copy); +stub!(test_copy_then_remove); diff --git a/crates/shirabe/tests/util/git_test.rs b/crates/shirabe/tests/util/git_test.rs index f8cf3d7..69539ef 100644 --- a/crates/shirabe/tests/util/git_test.rs +++ b/crates/shirabe/tests/util/git_test.rs @@ -1 +1,21 @@ //! ref: composer/tests/Composer/Test/Util/GitTest.php + +// These mock IO/Config/ProcessExecutor to drive Git::runCommand and mirror syncing; mocking +// is not available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/Config/ProcessExecutor to drive Git; mocking is not available"] + fn $name() { + todo!() + } + }; +} + +stub!(test_run_command_public_git_hub_repository_not_initial_clone); +stub!(test_run_command_private_git_hub_repository_not_initial_clone_not_interactive_without_authentication); +stub!(test_run_command_private_git_hub_repository_not_initial_clone_not_interactive_with_authentication); +stub!(test_run_command_private_bitbucket_repository_not_initial_clone_not_interactive_with_authentication); +stub!(test_run_command_private_bitbucket_repository_not_initial_clone_interactive_with_oauth); +stub!(test_sync_mirror_sanitizes_url_after_initial_clone); +stub!(test_sync_mirror_sanitizes_url_even_after_failed_update); diff --git a/crates/shirabe/tests/util/http/mod.rs b/crates/shirabe/tests/util/http/mod.rs index def35cb..a4f826f 100644 --- a/crates/shirabe/tests/util/http/mod.rs +++ b/crates/shirabe/tests/util/http/mod.rs @@ -1,2 +1,3 @@ mod proxy_item_test; +mod proxy_manager_test; mod request_proxy_test; diff --git a/crates/shirabe/tests/util/http/proxy_manager_test.rs b/crates/shirabe/tests/util/http/proxy_manager_test.rs index a37c45b..50be143 100644 --- a/crates/shirabe/tests/util/http/proxy_manager_test.rs +++ b/crates/shirabe/tests/util/http/proxy_manager_test.rs @@ -1 +1,21 @@ //! ref: composer/tests/Composer/Test/Util/Http/ProxyManagerTest.php + +// ProxyManager reads HTTP(S)_PROXY / CGI_HTTP_PROXY / no_proxy environment variables; the +// env-dependent setup (without its setUp/tearDown isolation) is not ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "not yet ported (ProxyManager is driven by proxy environment variables)"] + fn $name() { + todo!() + } + }; +} + +stub!(test_instantiation); +stub!(test_get_proxy_for_request_throws_on_bad_proxy_url); +stub!(test_lowercase_overrides_uppercase); +stub!(test_cgi_proxy_is_only_used_when_no_http_proxy); +stub!(test_no_http_proxy_does_not_use_https_proxy); +stub!(test_no_https_proxy_does_not_use_http_proxy); +stub!(test_get_proxy_for_request); diff --git a/crates/shirabe/tests/util/ini_helper_test.rs b/crates/shirabe/tests/util/ini_helper_test.rs index 54ab250..e214a78 100644 --- a/crates/shirabe/tests/util/ini_helper_test.rs +++ b/crates/shirabe/tests/util/ini_helper_test.rs @@ -4,7 +4,10 @@ use shirabe::util::ini_helper::IniHelper; use shirabe_php_shim::{PATH_SEPARATOR, putenv}; fn set_env(paths: &[&str]) { - putenv(&format!("COMPOSER_ORIGINAL_INIS={}", paths.join(PATH_SEPARATOR))); + putenv(&format!( + "COMPOSER_ORIGINAL_INIS={}", + paths.join(PATH_SEPARATOR) + )); } #[test] diff --git a/crates/shirabe/tests/util/main.rs b/crates/shirabe/tests/util/main.rs index cacd1a2..e779fe0 100644 --- a/crates/shirabe/tests/util/main.rs +++ b/crates/shirabe/tests/util/main.rs @@ -1,7 +1,11 @@ +mod auth_helper_test; +mod bitbucket_test; mod config_validator_test; mod error_handler_test; +mod filesystem_test; mod forgejo_test; mod forgejo_url_test; +mod git_test; mod github_test; mod gitlab_test; mod http; @@ -10,8 +14,13 @@ mod ini_helper_test; mod metadata_minifier_test; mod no_proxy_pattern_test; mod package_sorter_test; +mod perforce_test; mod platform_test; +mod process_executor_test; +mod remote_filesystem_test; mod silencer_test; +mod stream_context_factory_test; +mod svn_test; mod tar_test; mod tls_helper_test; mod url_test; diff --git a/crates/shirabe/tests/util/perforce_test.rs b/crates/shirabe/tests/util/perforce_test.rs index 3a1a5a3..3958b83 100644 --- a/crates/shirabe/tests/util/perforce_test.rs +++ b/crates/shirabe/tests/util/perforce_test.rs @@ -1 +1,52 @@ //! ref: composer/tests/Composer/Test/Util/PerforceTest.php + +// These mock IO and a ProcessExecutor to drive Perforce client/stream/command behaviour; +// mocking is not available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/ProcessExecutor to drive Perforce; mocking is not available"] + fn $name() { + todo!() + } + }; +} + +stub!(test_get_client_without_stream); +stub!(test_get_client_from_stream); +stub!(test_get_stream_without_stream); +stub!(test_get_stream_with_stream); +stub!(test_get_stream_without_label_with_stream_without_label); +stub!(test_get_stream_without_label_with_stream_with_label); +stub!(test_get_client_spec); +stub!(test_generate_p4_command); +stub!(test_query_p4_user_with_user_already_set); +stub!(test_query_p4_user_with_user_set_in_p4_variables_with_windows_os); +stub!(test_query_p4_user_with_user_set_in_p4_variables_not_windows_os); +stub!(test_query_p4_user_queries_for_user); +stub!(test_query_p4_user_stores_response_to_query_for_user_with_windows); +stub!(test_query_p4_user_stores_response_to_query_for_user_without_windows); +stub!(test_query_p4_user_escapes_injection_on_windows); +stub!(test_query_p4_user_escapes_injection_on_unix); +stub!(test_query_p4_password_with_password_already_set); +stub!(test_query_p4_password_with_password_set_in_p4_variables_with_windows_os); +stub!(test_query_p4_password_with_password_set_in_p4_variables_not_windows_os); +stub!(test_query_p4_password_queries_for_password); +stub!(test_write_p4_client_spec_without_stream); +stub!(test_write_p4_client_spec_with_stream); +stub!(test_is_logged_in); +stub!(test_get_branches_with_stream); +stub!(test_get_branches_without_stream); +stub!(test_get_tags_without_stream); +stub!(test_get_tags_with_stream); +stub!(test_check_stream_without_stream); +stub!(test_check_stream_with_stream); +stub!(test_get_composer_information_without_label_without_stream); +stub!(test_get_composer_information_with_label_without_stream); +stub!(test_get_composer_information_without_label_with_stream); +stub!(test_get_composer_information_with_label_with_stream); +stub!(test_sync_code_base_without_stream); +stub!(test_sync_code_base_with_stream); +stub!(test_check_server_exists); +stub!(test_check_server_client_error); +stub!(test_cleanup_client_spec_should_delete_client); diff --git a/crates/shirabe/tests/util/process_executor_test.rs b/crates/shirabe/tests/util/process_executor_test.rs index 6b30c9d..bfc6e0c 100644 --- a/crates/shirabe/tests/util/process_executor_test.rs +++ b/crates/shirabe/tests/util/process_executor_test.rs @@ -1 +1,26 @@ //! ref: composer/tests/Composer/Test/Util/ProcessExecutorTest.php + +// These run real subprocesses (capturing output/stderr/timeout) and assert ProcessExecutor's +// password hiding, line splitting and argument escaping; the subprocess execution and mocked +// IO are not ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "not yet ported (runs subprocesses / mocks IO; argument-escaping and split helpers included)"] + fn $name() { + todo!() + } + }; +} + +stub!(test_execute_captures_output); +stub!(test_execute_outputs_if_not_captured); +stub!(test_use_io_is_not_null_and_if_not_captured); +stub!(test_execute_captures_stderr); +stub!(test_timeout); +stub!(test_hide_passwords); +stub!(test_doesnt_hide_ports); +stub!(test_split_lines); +stub!(test_console_io_does_not_format_symfony_console_style); +stub!(test_execute_async_cancel); +stub!(test_escape_argument); diff --git a/crates/shirabe/tests/util/remote_filesystem_test.rs b/crates/shirabe/tests/util/remote_filesystem_test.rs index ffd1744..7b8fa2e 100644 --- a/crates/shirabe/tests/util/remote_filesystem_test.rs +++ b/crates/shirabe/tests/util/remote_filesystem_test.rs @@ -1 +1,28 @@ //! ref: composer/tests/Composer/Test/Util/RemoteFilesystemTest.php + +// These mock IO/Config/HttpDownloader and use reflection to drive RemoteFilesystem option +// building and downloads; mocking/reflection are not available and a real HttpDownloader +// reaches curl_multi_init (todo!()). +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/Config/HttpDownloader (curl_multi_init todo!()) and uses reflection; not ported"] + fn $name() { + todo!() + } + }; +} + +stub!(test_get_options_for_url); +stub!(test_get_options_for_url_with_authorization); +stub!(test_get_options_for_url_with_stream_options); +stub!(test_get_options_for_url_with_call_options_keeps_header); +stub!(test_callback_get_file_size); +stub!(test_callback_get_notify_progress); +stub!(test_callback_get_passes_through404); +stub!(test_get_contents); +stub!(test_copy); +stub!(test_copy_with_no_retry_on_failure); +stub!(test_copy_with_success_on_retry); +stub!(test_get_options_for_url_creates_secure_tls_defaults); +stub!(test_bit_bucket_public_download); diff --git a/crates/shirabe/tests/util/stream_context_factory_test.rs b/crates/shirabe/tests/util/stream_context_factory_test.rs index 4c18a09..6f484fa 100644 --- a/crates/shirabe/tests/util/stream_context_factory_test.rs +++ b/crates/shirabe/tests/util/stream_context_factory_test.rs @@ -1 +1,26 @@ //! ref: composer/tests/Composer/Test/Util/StreamContextFactoryTest.php + +// These build a stream context and assert proxy/option handling driven by HTTP(S)_PROXY / +// no_proxy environment variables; the env-dependent setup (without its setUp/tearDown +// isolation) is not ported. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "not yet ported (StreamContextFactory proxy/option building is driven by proxy env vars)"] + fn $name() { + todo!() + } + }; +} + +stub!(test_get_context); +stub!(test_http_proxy); +stub!(test_http_proxy_with_no_proxy); +stub!(test_http_proxy_with_no_proxy_wildcard); +stub!(test_options_are_preserved); +stub!(test_http_proxy_without_port); +stub!(test_https_proxy_override); +stub!(test_ssl_proxy); +stub!(test_ensure_thatfix_http_header_field_moves_content_type_to_end_of_options); +stub!(test_init_options_does_include_proxy_auth_headers); +stub!(test_init_options_for_curl_does_not_include_proxy_auth_headers); diff --git a/crates/shirabe/tests/util/svn_test.rs b/crates/shirabe/tests/util/svn_test.rs index 65cbeca..018a158 100644 --- a/crates/shirabe/tests/util/svn_test.rs +++ b/crates/shirabe/tests/util/svn_test.rs @@ -1 +1,19 @@ //! ref: composer/tests/Composer/Test/Util/SvnTest.php + +// These mock IO/Config and use reflection to drive Svn's credential handling; mocking and +// reflection are not available here. +macro_rules! stub { + ($name:ident) => { + #[test] + #[ignore = "mocks IO/Config and uses reflection to drive Svn credentials; not ported"] + fn $name() { + todo!() + } + }; +} + +stub!(test_credentials); +stub!(test_interactive_string); +stub!(test_credentials_from_config); +stub!(test_credentials_from_config_with_cache_credentials_true); +stub!(test_credentials_from_config_with_cache_credentials_false); |
