aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 04:41:01 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 04:41:01 +0900
commita5b5366492d87ebf3fd0b1aaf77c15dfa978ae95 (patch)
treeaf993f05750537f53b9cbce3457715128599f0ea /crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
parent46ff68a20235cb6ba05d00b001f334abc303eef8 (diff)
downloadphp-shirabe-a5b5366492d87ebf3fd0b1aaf77c15dfa978ae95.tar.gz
php-shirabe-a5b5366492d87ebf3fd0b1aaf77c15dfa978ae95.tar.zst
php-shirabe-a5b5366492d87ebf3fd0b1aaf77c15dfa978ae95.zip
test(repository): port VCS driver tests (Git/GitHub/GitLab/Bitbucket/Svn/Perforce/Forgejo)
Svn/GitBitbucket/Perforce supports pass. GitHub::supports reaches non-strict in_array (todo!()) and Forgejo::supports uses a regex the regex crate cannot compile, so those are ignored. All API-driven cases mock the HttpDownloader (curl) / ProcessExecutor and are stubbed. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs')
-rw-r--r--crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs73
1 files changed, 73 insertions, 0 deletions
diff --git a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
index 2c6d427..e48c609 100644
--- a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
@@ -1 +1,74 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+use shirabe::config::Config;
+use shirabe::io::IOInterface;
+use shirabe::io::null_io::NullIO;
+use shirabe::repository::vcs::GitBitbucketDriver;
+
+#[test]
+fn test_supports() {
+ let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let config = Rc::new(RefCell::new(Config::new(true, None)));
+
+ assert!(
+ GitBitbucketDriver::supports(
+ io.clone(),
+ config.clone(),
+ "https://bitbucket.org/user/repo.git",
+ false
+ )
+ .unwrap()
+ );
+
+ // should not be changed, see https://github.com/composer/composer/issues/9400
+ assert!(
+ !GitBitbucketDriver::supports(
+ io.clone(),
+ config.clone(),
+ "git@bitbucket.org:user/repo.git",
+ false
+ )
+ .unwrap()
+ );
+
+ assert!(
+ !GitBitbucketDriver::supports(io, config, "https://github.com/user/repo.git", false)
+ .unwrap()
+ );
+}
+
+// The remaining cases construct a GitBitbucketDriver and mock the HttpDownloader to return
+// Bitbucket API responses; mocking is not available, and a real HttpDownloader reaches
+// curl_multi_init (todo!()).
+#[test]
+#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+fn test_get_root_identifier_wrong_scm_type() {
+ todo!()
+}
+
+#[test]
+#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+fn test_driver() {
+ todo!()
+}
+
+#[test]
+#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+fn test_get_params() {
+ todo!()
+}
+
+#[test]
+#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+fn test_initialize_invalid_repository_url() {
+ todo!()
+}
+
+#[test]
+#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+fn test_invalid_support_data() {
+ todo!()
+}