aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/util
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/util
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/util')
-rw-r--r--crates/shirabe/tests/util/auth_helper_test.rs33
-rw-r--r--crates/shirabe/tests/util/bitbucket_test.rs28
-rw-r--r--crates/shirabe/tests/util/filesystem_test.rs26
-rw-r--r--crates/shirabe/tests/util/git_test.rs20
-rw-r--r--crates/shirabe/tests/util/http/mod.rs1
-rw-r--r--crates/shirabe/tests/util/http/proxy_manager_test.rs20
-rw-r--r--crates/shirabe/tests/util/ini_helper_test.rs5
-rw-r--r--crates/shirabe/tests/util/main.rs9
-rw-r--r--crates/shirabe/tests/util/perforce_test.rs51
-rw-r--r--crates/shirabe/tests/util/process_executor_test.rs25
-rw-r--r--crates/shirabe/tests/util/remote_filesystem_test.rs27
-rw-r--r--crates/shirabe/tests/util/stream_context_factory_test.rs25
-rw-r--r--crates/shirabe/tests/util/svn_test.rs18
13 files changed, 287 insertions, 1 deletions
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);