diff options
Diffstat (limited to 'crates/shirabe/src/repository/path_repository.rs')
| -rw-r--r-- | crates/shirabe/src/repository/path_repository.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs index 4508460..b8c106a 100644 --- a/crates/shirabe/src/repository/path_repository.rs +++ b/crates/shirabe/src/repository/path_repository.rs @@ -113,6 +113,32 @@ impl PathRepository { ) } + /// For testing only: drives `initialize` (globbing the configured url and loading each + /// path package) and returns the packages collected by the inner `ArrayRepository`, + /// mirroring the polymorphic `RepositoryInterface::getPackages` dispatch in PHP. + pub fn __get_packages(&mut self) -> anyhow::Result<Vec<crate::package::BasePackageHandle>> { + self.initialize()?; + use crate::repository::RepositoryInterface; + self.inner.get_packages() + } + + /// For testing only: returns `RepositoryInterface::count` after `initialize`. + pub fn __count(&mut self) -> anyhow::Result<usize> { + self.initialize()?; + use crate::repository::RepositoryInterface; + self.inner.count() + } + + /// For testing only: returns `RepositoryInterface::has_package` after `initialize`. + pub fn __has_package( + &mut self, + package: crate::package::PackageInterfaceHandle, + ) -> anyhow::Result<bool> { + self.initialize()?; + use crate::repository::RepositoryInterface; + Ok(self.inner.has_package(package)) + } + pub(crate) fn initialize(&mut self) -> anyhow::Result<()> { self.inner.initialize(); |
