diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/shirabe/tests/common/test_case.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe/tests/package/locker_test.rs | 23 |
2 files changed, 2 insertions, 23 deletions
diff --git a/crates/shirabe/tests/common/test_case.rs b/crates/shirabe/tests/common/test_case.rs index 5bfc2d0f..4adee211 100644 --- a/crates/shirabe/tests/common/test_case.rs +++ b/crates/shirabe/tests/common/test_case.rs @@ -174,7 +174,7 @@ fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> { /// ref: FactoryMock::createInstallationManager (the real installers are never created in tests, so a /// bare InstallationManager over a mock HttpDownloader suffices). -fn installation_manager( +pub(crate) fn installation_manager( io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, ) -> std::rc::Rc<std::cell::RefCell<InstallationManager>> { let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None))); diff --git a/crates/shirabe/tests/package/locker_test.rs b/crates/shirabe/tests/package/locker_test.rs index fc66293b..c355c774 100644 --- a/crates/shirabe/tests/package/locker_test.rs +++ b/crates/shirabe/tests/package/locker_test.rs @@ -1,8 +1,7 @@ //! ref: composer/tests/Composer/Test/Package/LockerTest.php +use crate::test_case::installation_manager; use indexmap::IndexMap; -use shirabe::config::Config; -use shirabe::installer::InstallationManager; use shirabe::io::IOInterface; use shirabe::io::null_io::NullIO; use shirabe::json::{JsonEncodeOptions, JsonFile}; @@ -10,8 +9,6 @@ use shirabe::package::Locker; use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle}; use shirabe::plugin::plugin_interface; use shirabe::repository::{FindPackageConstraint, RepositoryInterfaceHandle}; -use shirabe::util::http_downloader::HttpDownloader; -use shirabe::util::r#loop::Loop; use shirabe::util::process_executor::ProcessExecutor; use shirabe_php_shim::{LogicException, PhpMixed, hash}; use tempfile::TempDir; @@ -20,24 +17,6 @@ fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> { std::rc::Rc::new(std::cell::RefCell::new(NullIO::new())) } -fn installation_manager( - io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, -) -> std::rc::Rc<std::cell::RefCell<InstallationManager>> { - // These tests never reach Locker::get_package_time, so the InstallationManager is never - // actually used; build it over a mock HttpDownloader to avoid the unimplemented curl backend. - let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None))); - let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock( - io.clone(), - config, - ))); - let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None))); - std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::new( - r#loop, - io.clone(), - None, - ))) -} - /// ref: LockerTest::getJsonContent — `JsonFile::encode(ksort([minimum-stability, name]), 0)`. fn get_json_content(custom_data: &[(&str, &str)]) -> String { let mut data: IndexMap<String, PhpMixed> = IndexMap::new(); |
