aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-01 21:39:45 +0900
committernsfisis <nsfisis@gmail.com>2026-07-01 21:39:45 +0900
commit1e849939b9f92fc04c2343cc5770d1f55ab71f66 (patch)
treeabdab68aa4a25270dfb923ee97e9cfc1f8a75c93 /crates/shirabe/tests/repository
parent66723bc24f9eef827b239d3406ba41256ec6b5b8 (diff)
downloadphp-shirabe-1e849939b9f92fc04c2343cc5770d1f55ab71f66.tar.gz
php-shirabe-1e849939b9f92fc04c2343cc5770d1f55ab71f66.tar.zst
php-shirabe-1e849939b9f92fc04c2343cc5770d1f55ab71f66.zip
test(repository-manager): port testFilterRepoWrapping
PathRepository already implements RepositoryInterface and create_repository already handles the "path" class, so the prior ignore reason no longer applies; verify the FilterRepository/PathRepository wrapping via RepositoryInterfaceHandle::is/downcast_rc.
Diffstat (limited to 'crates/shirabe/tests/repository')
-rw-r--r--crates/shirabe/tests/repository/repository_manager_test.rs33
1 files changed, 30 insertions, 3 deletions
diff --git a/crates/shirabe/tests/repository/repository_manager_test.rs b/crates/shirabe/tests/repository/repository_manager_test.rs
index 089ce9a..c67cec4 100644
--- a/crates/shirabe/tests/repository/repository_manager_test.rs
+++ b/crates/shirabe/tests/repository/repository_manager_test.rs
@@ -8,7 +8,9 @@ use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
-use shirabe::repository::{ArrayRepository, RepositoryInterfaceHandle, RepositoryManager};
+use shirabe::repository::{
+ ArrayRepository, FilterRepository, PathRepository, RepositoryInterfaceHandle, RepositoryManager,
+};
use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_php_shim::PhpMixed;
@@ -210,9 +212,34 @@ fn test_invalid_repo_creation_throws() {
}
#[test]
-#[ignore = "PathRepository does not implement RepositoryInterface (only ConfigurableRepositoryInterface), so it cannot live inside a RepositoryInterfaceHandle nor be recovered via as_any().downcast_ref::<PathRepository>(); the assertInstanceOf(PathRepository) check is unportable"]
fn test_filter_repo_wrapping() {
let SetUp { tmpdir } = set_up();
let _tear_down = TearDown::new(tmpdir.path().to_path_buf());
- todo!()
+
+ let io = null_io();
+ let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let mut rm = RepositoryManager::new(io.clone(), config, http_downloader(&io), None, None);
+
+ rm.set_repository_class("path", "Composer\\Repository\\PathRepository");
+ let repo = rm
+ .create_repository(
+ "path",
+ str_config(&[
+ ("type", PhpMixed::String("path".to_string())),
+ (
+ "url",
+ PhpMixed::String(format!("{}/tests/repository", env!("CARGO_MANIFEST_DIR"))),
+ ),
+ (
+ "only",
+ PhpMixed::List(vec![PhpMixed::String("foo/bar".to_string())]),
+ ),
+ ]),
+ None,
+ )
+ .unwrap();
+
+ assert!(repo.is::<FilterRepository>());
+ let filter = repo.downcast_rc::<FilterRepository>().unwrap();
+ assert!(filter.borrow().get_repository().is::<PathRepository>());
}