diff options
Diffstat (limited to 'crates/shirabe/tests/util')
| -rw-r--r-- | crates/shirabe/tests/util/auth_helper_test.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/bitbucket_test.rs | 14 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/config_validator_test.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/forgejo_test.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/git_test.rs | 14 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/github_test.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/gitlab_test.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/http_downloader_test.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/perforce_test.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/process_executor_test.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/remote_filesystem_test.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/tests/util/svn_test.rs | 5 |
12 files changed, 49 insertions, 70 deletions
diff --git a/crates/shirabe/tests/util/auth_helper_test.rs b/crates/shirabe/tests/util/auth_helper_test.rs index 7738afb..905cbf7 100644 --- a/crates/shirabe/tests/util/auth_helper_test.rs +++ b/crates/shirabe/tests/util/auth_helper_test.rs @@ -1,17 +1,15 @@ //! ref: composer/tests/Composer/Test/Util/AuthHelperTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::io_mock::{Expectation, IOMock, get_io_mock}; use indexmap::IndexMap; use shirabe::config::ConfigSourceInterface; use shirabe::io::IOInterface; use shirabe::io::io_interface; use shirabe::util::{AuthHelper, Bitbucket, StoreAuth}; use shirabe_php_shim::{PhpMixed, base64_encode, json_encode}; - -use crate::config_stub::ConfigStubBuilder; -use crate::io_mock::{Expectation, IOMock, get_io_mock}; +use std::cell::RefCell; +use std::rc::Rc; // Mirrors AuthHelperTest::setUp: a DEBUG-verbosity IOMock plus a real Config, both // shared with the AuthHelper under test. The IOMockGuard runs assert_complete on drop. diff --git a/crates/shirabe/tests/util/bitbucket_test.rs b/crates/shirabe/tests/util/bitbucket_test.rs index 2817266..db45b3e 100644 --- a/crates/shirabe/tests/util/bitbucket_test.rs +++ b/crates/shirabe/tests/util/bitbucket_test.rs @@ -1,8 +1,9 @@ //! ref: composer/tests/Composer/Test/Util/BitbucketTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; +use crate::io_mock::{Expectation, IOMock, get_io_mock}; +use crate::process_executor_mock::get_process_executor_mock; use indexmap::IndexMap; use shirabe::config::{Config, ConfigSourceInterface}; use shirabe::io::IOInterface; @@ -13,11 +14,8 @@ use shirabe::util::http_downloader::{ }; use shirabe::util::process_executor::MockHandler; use shirabe_php_shim::{PhpMixed, time}; - -use crate::config_stub::ConfigStubBuilder; -use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; -use crate::io_mock::{Expectation, IOMock, get_io_mock}; -use crate::process_executor_mock::get_process_executor_mock; +use std::cell::RefCell; +use std::rc::Rc; const USERNAME: &str = "username"; const PASSWORD: &str = "password"; diff --git a/crates/shirabe/tests/util/config_validator_test.rs b/crates/shirabe/tests/util/config_validator_test.rs index 94e5792..6d7aaf8 100644 --- a/crates/shirabe/tests/util/config_validator_test.rs +++ b/crates/shirabe/tests/util/config_validator_test.rs @@ -1,12 +1,11 @@ //! ref: composer/tests/Composer/Test/Util/ConfigValidatorTest.php -use std::cell::RefCell; -use std::rc::Rc; - use shirabe::io::io_interface::IOInterface; use shirabe::io::null_io::NullIO; use shirabe::package::loader::validating_array_loader::ValidatingArrayLoader; use shirabe::util::config_validator::ConfigValidator; +use std::cell::RefCell; +use std::rc::Rc; fn fixture(name: &str) -> String { format!( diff --git a/crates/shirabe/tests/util/forgejo_test.rs b/crates/shirabe/tests/util/forgejo_test.rs index a1a8f9c..106cdab 100644 --- a/crates/shirabe/tests/util/forgejo_test.rs +++ b/crates/shirabe/tests/util/forgejo_test.rs @@ -1,18 +1,16 @@ //! ref: composer/tests/Composer/Test/Util/ForgejoTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; +use crate::io_mock::{Expectation, IOMock, get_io_mock}; use shirabe::config::{Config, ConfigSourceInterface}; use shirabe::io::IOInterface; use shirabe::io::io_interface; use shirabe::util::Forgejo; use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler}; use shirabe_php_shim::PhpMixed; - -use crate::config_stub::ConfigStubBuilder; -use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; -use crate::io_mock::{Expectation, IOMock, get_io_mock}; +use std::cell::RefCell; +use std::rc::Rc; const USERNAME: &str = "username"; const ACCESS_TOKEN: &str = "access-token"; diff --git a/crates/shirabe/tests/util/git_test.rs b/crates/shirabe/tests/util/git_test.rs index 80037da..43af80a 100644 --- a/crates/shirabe/tests/util/git_test.rs +++ b/crates/shirabe/tests/util/git_test.rs @@ -1,8 +1,9 @@ //! ref: composer/tests/Composer/Test/Util/GitTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; +use crate::io_stub::IOStub; +use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock}; use indexmap::IndexMap; use shirabe::config::{Config, ConfigSourceInterface}; use shirabe::io::IOInterface; @@ -11,11 +12,8 @@ use shirabe::util::git::Git; use shirabe::util::http_downloader::HttpDownloaderMockHandler; use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor}; use shirabe_php_shim::{PhpMixed, RuntimeException}; - -use crate::config_stub::ConfigStubBuilder; -use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; -use crate::io_stub::IOStub; -use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock}; +use std::cell::RefCell; +use std::rc::Rc; // No-op ConfigSourceInterface, equivalent to PHPUnit's // `getMockBuilder(Config::class)` auto-stubbing getConfigSource/getAuthConfigSource: diff --git a/crates/shirabe/tests/util/github_test.rs b/crates/shirabe/tests/util/github_test.rs index 0069a9c..b9abeb2 100644 --- a/crates/shirabe/tests/util/github_test.rs +++ b/crates/shirabe/tests/util/github_test.rs @@ -1,18 +1,16 @@ //! ref: composer/tests/Composer/Test/Util/GitHubTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; +use crate::io_mock::{Expectation, IOMock, get_io_mock}; use shirabe::config::{Config, ConfigSourceInterface}; use shirabe::io::IOInterface; use shirabe::io::io_interface; use shirabe::util::GitHub; use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler}; use shirabe_php_shim::PhpMixed; - -use crate::config_stub::ConfigStubBuilder; -use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; -use crate::io_mock::{Expectation, IOMock, get_io_mock}; +use std::cell::RefCell; +use std::rc::Rc; const PASSWORD: &str = "password"; const MESSAGE: &str = "mymessage"; diff --git a/crates/shirabe/tests/util/gitlab_test.rs b/crates/shirabe/tests/util/gitlab_test.rs index a3db85b..46c0358 100644 --- a/crates/shirabe/tests/util/gitlab_test.rs +++ b/crates/shirabe/tests/util/gitlab_test.rs @@ -1,18 +1,16 @@ //! ref: composer/tests/Composer/Test/Util/GitLabTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; +use crate::io_mock::{Expectation, IOMock, get_io_mock}; use shirabe::config::{Config, ConfigSourceInterface}; use shirabe::io::IOInterface; use shirabe::io::io_interface; use shirabe::util::GitLab; use shirabe::util::http_downloader::HttpDownloaderMockHandler; use shirabe_php_shim::PhpMixed; - -use crate::config_stub::ConfigStubBuilder; -use crate::http_downloader_mock::{expect_full, get_http_downloader_mock}; -use crate::io_mock::{Expectation, IOMock, get_io_mock}; +use std::cell::RefCell; +use std::rc::Rc; const USERNAME: &str = "username"; const PASSWORD: &str = "password"; diff --git a/crates/shirabe/tests/util/http_downloader_test.rs b/crates/shirabe/tests/util/http_downloader_test.rs index 078fd57..b184184 100644 --- a/crates/shirabe/tests/util/http_downloader_test.rs +++ b/crates/shirabe/tests/util/http_downloader_test.rs @@ -1,8 +1,7 @@ //! ref: composer/tests/Composer/Test/Util/HttpDownloaderTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::io_mock::{Expectation, get_io_mock}; use indexmap::IndexMap; use shirabe::config::Config; use shirabe::downloader::TransportException; @@ -13,9 +12,8 @@ use shirabe::util::Platform; use shirabe::util::http_downloader::HttpDownloader; use shirabe_external_packages::symfony::console::output::output_interface::VERBOSITY_NORMAL; use shirabe_php_shim::{PHP_EOL, PhpMixed}; - -use crate::config_stub::ConfigStubBuilder; -use crate::io_mock::{Expectation, get_io_mock}; +use std::cell::RefCell; +use std::rc::Rc; // PHP performs a live HTTP get to assert the URL's user:pass is captured via // setAuthentication. The credential capture happens in `add_job`, before any diff --git a/crates/shirabe/tests/util/perforce_test.rs b/crates/shirabe/tests/util/perforce_test.rs index 482094f..b6f8f11 100644 --- a/crates/shirabe/tests/util/perforce_test.rs +++ b/crates/shirabe/tests/util/perforce_test.rs @@ -1,8 +1,7 @@ //! ref: composer/tests/Composer/Test/Util/PerforceTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::io_stub::IOStub; +use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock}; use indexmap::IndexMap; use serial_test::serial; use shirabe::io::{IOInterface, NullIO}; @@ -10,9 +9,8 @@ use shirabe::util::Perforce; use shirabe::util::filesystem::Filesystem; use shirabe::util::process_executor::{MockHandler, ProcessExecutor}; use shirabe_php_shim::PhpMixed; - -use crate::io_stub::IOStub; -use crate::process_executor_mock::{cmd, cmd_full, get_process_executor_mock}; +use std::cell::RefCell; +use std::rc::Rc; const TEST_DEPOT: &str = "depot"; const TEST_BRANCH: &str = "branch"; diff --git a/crates/shirabe/tests/util/process_executor_test.rs b/crates/shirabe/tests/util/process_executor_test.rs index 01e37ed..78c5f9f 100644 --- a/crates/shirabe/tests/util/process_executor_test.rs +++ b/crates/shirabe/tests/util/process_executor_test.rs @@ -4,9 +4,6 @@ // password hiding, line splitting and argument escaping; the subprocess execution and mocked // IO are not ported. -use std::cell::RefCell; -use std::rc::Rc; - use shirabe::io::ConsoleIO; use shirabe::io::IOInterface; use shirabe::io::buffer_io::BufferIO; @@ -19,6 +16,8 @@ use shirabe_external_packages::symfony::console::output::output_interface::{ OutputInterface, VERBOSITY_DEBUG, VERBOSITY_NORMAL, }; use shirabe_php_shim::{PHP_EOL, trim}; +use std::cell::RefCell; +use std::rc::Rc; #[test] fn test_execute_captures_output() { diff --git a/crates/shirabe/tests/util/remote_filesystem_test.rs b/crates/shirabe/tests/util/remote_filesystem_test.rs index a5d9d66..ba79757 100644 --- a/crates/shirabe/tests/util/remote_filesystem_test.rs +++ b/crates/shirabe/tests/util/remote_filesystem_test.rs @@ -1,15 +1,13 @@ //! ref: composer/tests/Composer/Test/Util/RemoteFilesystemTest.php -use std::cell::RefCell; -use std::rc::Rc; - +use crate::config_stub::ConfigStubBuilder; +use crate::io_stub::IOStub; use indexmap::IndexMap; use shirabe::io::IOInterface; use shirabe::util::RemoteFilesystem; use shirabe_php_shim::{PhpMixed, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS, strpos}; - -use crate::config_stub::ConfigStubBuilder; -use crate::io_stub::IOStub; +use std::cell::RefCell; +use std::rc::Rc; // Mirrors RemoteFilesystemTest::getConfigMock: get('github-domains') and // get('gitlab-domains') return [], everything else returns null. add_authentication_options diff --git a/crates/shirabe/tests/util/svn_test.rs b/crates/shirabe/tests/util/svn_test.rs index 7a30d8b..f700634 100644 --- a/crates/shirabe/tests/util/svn_test.rs +++ b/crates/shirabe/tests/util/svn_test.rs @@ -1,14 +1,13 @@ //! ref: composer/tests/Composer/Test/Util/SvnTest.php -use std::cell::RefCell; -use std::rc::Rc; - use indexmap::IndexMap; use shirabe::config::Config; use shirabe::io::IOInterface; use shirabe::io::null_io::NullIO; use shirabe::util::svn::Svn; use shirabe_php_shim::PhpMixed; +use std::cell::RefCell; +use std::rc::Rc; fn map(pairs: Vec<(&str, PhpMixed)>) -> IndexMap<String, PhpMixed> { pairs.into_iter().map(|(k, v)| (k.to_string(), v)).collect() |
