aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/package
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-11 16:33:05 +0900
committernsfisis <nsfisis@gmail.com>2026-07-11 16:33:05 +0900
commit27d00055df8691a6bd99aaf38633a7338b16cc6a (patch)
tree4af17ccff5f8c2d09156fa62c559e60e3e683dac /crates/shirabe/tests/package
parent1ec2220def43e37e5a65b96dde93c19b493258f4 (diff)
downloadphp-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.tar.gz
php-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.tar.zst
php-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.zip
chore: use fully-qualified name for Rc/RefCell
Diffstat (limited to 'crates/shirabe/tests/package')
-rw-r--r--crates/shirabe/tests/package/archiver/archive_manager_test.rs26
-rw-r--r--crates/shirabe/tests/package/loader/root_package_loader_test.rs32
-rw-r--r--crates/shirabe/tests/package/locker_test.rs31
-rw-r--r--crates/shirabe/tests/package/version/version_guesser_test.rs14
-rw-r--r--crates/shirabe/tests/package/version/version_selector_test.rs18
5 files changed, 64 insertions, 57 deletions
diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
index b275692b..4f28b468 100644
--- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs
+++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
@@ -16,8 +16,6 @@ use shirabe_external_packages::symfony::process::Process;
use shirabe_php_shim::{
PhpMixed, file_exists, file_put_contents, realpath, sys_get_temp_dir, unlink,
};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
// ref: ArchiverTestCase::setUp + ArchiveManagerTest::setUp.
@@ -36,30 +34,34 @@ impl TestCase {
let guard = TempDir::new().unwrap();
let test_dir = guard.path().to_string_lossy().to_string();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
// The filename/unknown-format tests never drive the download path, so a mock
// HttpDownloader (no curl backend) is sufficient to satisfy Loop's dependency.
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(
+ HttpDownloader::__new_mock(io.clone(), config.clone()),
+ ));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
io.clone(),
- config.clone(),
- )));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
- let fs = Rc::new(RefCell::new(Filesystem::new(Some(process.clone()))));
+ ))));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(Some(
+ process.clone(),
+ ))));
let mut dm = DownloadManager::new(io.clone(), false, Some(fs.clone()));
// Factory::createDownloadManager registers a git downloader; the archive tests clone the
// package source (source type 'git') through it.
dm.set_downloader(
"git",
- Rc::new(RefCell::new(GitDownloader::new(
+ std::rc::Rc::new(std::cell::RefCell::new(GitDownloader::new(
io.clone(),
config.clone(),
Some(process.clone()),
Some(fs.clone()),
))),
);
- let dm = Rc::new(RefCell::new(dm));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
+ let dm = std::rc::Rc::new(std::cell::RefCell::new(dm));
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
let mut manager = ArchiveManager::new(dm, r#loop);
manager.add_archiver(Box::new(ZipArchiver::new()));
diff --git a/crates/shirabe/tests/package/loader/root_package_loader_test.rs b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
index 6a13736d..069cf5a7 100644
--- a/crates/shirabe/tests/package/loader/root_package_loader_test.rs
+++ b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
@@ -21,18 +21,16 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
fn http_downloader(
- io: &Rc<RefCell<dyn IOInterface>>,
- config: &Rc<RefCell<Config>>,
-) -> Rc<RefCell<HttpDownloader>> {
- Rc::new(RefCell::new(HttpDownloader::new(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
+) -> std::rc::Rc<std::cell::RefCell<HttpDownloader>> {
+ std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
@@ -41,8 +39,8 @@ fn http_downloader(
}
// `$config = new Config; $config->merge(['repositories' => ['packagist' => false]]);`
-fn make_config() -> Rc<RefCell<Config>> {
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+fn make_config() -> std::rc::Rc<std::cell::RefCell<Config>> {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
let mut repositories: IndexMap<String, PhpMixed> = IndexMap::new();
repositories.insert("packagist".to_string(), PhpMixed::Bool(false));
let mut merge: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -54,10 +52,10 @@ fn make_config() -> Rc<RefCell<Config>> {
// Stands in for `getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()`.
// The loader only stores it and feeds it default repositories, so a real instance suffices.
fn make_manager(
- io: &Rc<RefCell<dyn IOInterface>>,
- config: &Rc<RefCell<Config>>,
-) -> Rc<RefCell<RepositoryManager>> {
- Rc::new(RefCell::new(RepositoryManager::new(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
+) -> std::rc::Rc<std::cell::RefCell<RepositoryManager>> {
+ std::rc::Rc::new(std::cell::RefCell::new(RepositoryManager::new(
io.clone(),
config.clone(),
http_downloader(io, config),
@@ -103,7 +101,7 @@ mockall::mock! {
#[ignore = "process_executor.enable_async() drives the async stream path, which calls stream_set_blocking (fcntl(2) todo!() in shirabe-php-shim::stream)"]
fn test_stability_flags_parsing() {
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
{
let mut cfg = IndexMap::new();
cfg.insert(
@@ -117,7 +115,7 @@ fn test_stability_flags_parsing() {
config.borrow_mut().merge(&cfg, "test");
}
- let manager = Rc::new(RefCell::new(RepositoryManager::new(
+ let manager = std::rc::Rc::new(std::cell::RefCell::new(RepositoryManager::new(
io.clone(),
config.clone(),
http_downloader(&io, &config),
@@ -129,7 +127,7 @@ fn test_stability_flags_parsing() {
process_executor.enable_async();
let guesser = VersionGuesser::new(
config.clone(),
- Rc::new(RefCell::new(process_executor)),
+ std::rc::Rc::new(std::cell::RefCell::new(process_executor)),
VersionParser::new(),
Some(io.clone()),
);
diff --git a/crates/shirabe/tests/package/locker_test.rs b/crates/shirabe/tests/package/locker_test.rs
index bbc333e7..fc66293b 100644
--- a/crates/shirabe/tests/package/locker_test.rs
+++ b/crates/shirabe/tests/package/locker_test.rs
@@ -14,21 +14,24 @@ 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 std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+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: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<InstallationManager>> {
+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 = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(io.clone(), config)));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
- Rc::new(RefCell::new(InstallationManager::new(
+ 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,
@@ -57,7 +60,11 @@ fn get_json_content(custom_data: &[(&str, &str)]) -> String {
fn make_locker(
json_content: &str,
lock_contents: Option<&str>,
-) -> (Locker, TempDir, Rc<RefCell<dyn IOInterface>>) {
+) -> (
+ Locker,
+ TempDir,
+ std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) {
let temp_dir = TempDir::new().unwrap();
let lock_path = temp_dir.path().join("composer.lock");
if let Some(contents) = lock_contents {
@@ -66,7 +73,9 @@ fn make_locker(
let io = null_io();
let json_file = JsonFile::new(lock_path.to_string_lossy().into_owned(), None, None).unwrap();
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let locker = Locker::new(
io.clone(),
json_file,
diff --git a/crates/shirabe/tests/package/version/version_guesser_test.rs b/crates/shirabe/tests/package/version/version_guesser_test.rs
index 1a3f23c1..92d5e90b 100644
--- a/crates/shirabe/tests/package/version/version_guesser_test.rs
+++ b/crates/shirabe/tests/package/version/version_guesser_test.rs
@@ -9,8 +9,6 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
// Mirrors VersionGuesserTest::setUp/tearDown: reset GitUtil's cached `version`
// static so each test re-runs `git --version` against its own mock.
@@ -27,19 +25,19 @@ impl Drop for TearDown {
}
// `$config = new Config; $config->merge(['repositories' => ['packagist' => false]]);`
-fn make_config() -> Rc<RefCell<Config>> {
+fn make_config() -> std::rc::Rc<std::cell::RefCell<Config>> {
let mut config = Config::new(true, None);
let mut repositories: IndexMap<String, PhpMixed> = IndexMap::new();
repositories.insert("packagist".to_string(), PhpMixed::Bool(false));
let mut merge: IndexMap<String, PhpMixed> = IndexMap::new();
merge.insert("repositories".to_string(), PhpMixed::Array(repositories));
config.merge(&merge, Config::SOURCE_UNKNOWN);
- Rc::new(RefCell::new(config))
+ std::rc::Rc::new(std::cell::RefCell::new(config))
}
fn make_guesser(
- config: Rc<RefCell<Config>>,
- process: Rc<RefCell<ProcessExecutor>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> VersionGuesser {
VersionGuesser::new(config, process, VersionParser::new(), None)
}
@@ -615,8 +613,8 @@ fn test_get_root_version_from_env() {
for (env, expected_version) in root_env_versions {
Platform::put_env("COMPOSER_ROOT_VERSION", env);
- let config = Rc::new(RefCell::new(Config::new(true, None)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let guesser = VersionGuesser::new(config, process, VersionParser::new(), None);
assert_eq!(
expected_version,
diff --git a/crates/shirabe/tests/package/version/version_selector_test.rs b/crates/shirabe/tests/package/version/version_selector_test.rs
index 3a0c7019..70874bcb 100644
--- a/crates/shirabe/tests/package/version/version_selector_test.rs
+++ b/crates/shirabe/tests/package/version/version_selector_test.rs
@@ -19,8 +19,6 @@ use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PhpMixed;
use shirabe_php_shim::{PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION};
use shirabe_semver::constraint::AnyConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
mockall::mock! {
RepositorySet {}
@@ -41,8 +39,10 @@ impl std::fmt::Debug for MockRepositorySet {
}
}
-fn into_seam(mock: MockRepositorySet) -> Rc<RefCell<dyn RepositorySetInterface>> {
- Rc::new(RefCell::new(mock))
+fn into_seam(
+ mock: MockRepositorySet,
+) -> std::rc::Rc<std::cell::RefCell<dyn RepositorySetInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(mock))
}
/// Mirrors PHPUnit `assertSame($expected, $best)`: object identity, not value equality.
@@ -77,7 +77,7 @@ fn find_best(
dyn shirabe::filter::platform_requirement_filter::PlatformRequirementFilterInterface,
>,
>,
- io: Option<Rc<RefCell<dyn IOInterface>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
) -> Option<PackageInterfaceHandle> {
version_selector
.find_best_candidate(
@@ -159,10 +159,10 @@ fn test_latest_version_is_returned_that_matches_php_requirements() {
let mut version_selector =
VersionSelector::new(into_seam(repository_set), Some(&mut platform)).unwrap();
- let io = Rc::new(RefCell::new(
+ let io = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
));
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let best = find_best(
&mut version_selector,
package_name,
@@ -180,10 +180,10 @@ fn test_latest_version_is_returned_that_matches_php_requirements() {
io.borrow().get_output()
);
- let io = Rc::new(RefCell::new(
+ let io = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_VERBOSE, None).unwrap(),
));
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let best = find_best(
&mut version_selector,
package_name,