diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-06 20:38:00 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-06 20:38:00 +0900 |
| commit | 9411867aa23f8f4f3a6b21b4e8ca9f498a16283a (patch) | |
| tree | 1d679d8fa48fcae87b036a00301c9fba0d210b3f /crates/shirabe/tests/downloader | |
| parent | f18efec69df00cf61e3ec595d07131cae7ca0372 (diff) | |
| download | php-shirabe-9411867aa23f8f4f3a6b21b4e8ca9f498a16283a.tar.gz php-shirabe-9411867aa23f8f4f3a6b21b4e8ca9f498a16283a.tar.zst php-shirabe-9411867aa23f8f4f3a6b21b4e8ca9f498a16283a.zip | |
fix(download-manager): name the downloader class in its LogicException
getDownloaderForPackage reports get_class($downloader) when the resolved
downloader's installation source does not match. Rust has no runtime class
name, so the message was built from a shim stub that panicked instead —
the error could never be returned.
DownloaderInterface now requires PhpClass, the trait already used for the
same purpose on Command, and each downloader states the name PHP reports.
That leaves get_class_obj without callers, so it is gone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/downloader')
| -rw-r--r-- | crates/shirabe/tests/downloader/download_manager_test.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/shirabe/tests/downloader/download_manager_test.rs b/crates/shirabe/tests/downloader/download_manager_test.rs index 9b45d47a..b7d88a21 100644 --- a/crates/shirabe/tests/downloader/download_manager_test.rs +++ b/crates/shirabe/tests/downloader/download_manager_test.rs @@ -59,6 +59,10 @@ mockall::mock! { } } +// PHPUnit reports a generated class name for `getMockBuilder(DownloaderInterface::class)`; +// no ported assertion reads it, so the mock answers with the interface it stands in for. +shirabe_php_shim::impl_php_class!(MockDownloader, r"Composer\Downloader\DownloaderInterface"); + /// ref: DownloadManagerTest::createPackageMock /// /// PHPUnit returns a `PackageInterface` mock; a real CompletePackage with the @@ -169,10 +173,6 @@ fn test_get_downloader_for_correctly_installed_dist_package() { assert!(std::rc::Rc::ptr_eq(&downloader, &result)); } -// The LogicException message uses get_class($downloader); the equivalent -// `shirabe_php_shim::get_class_obj` is still a `todo!()`, so building the error -// panics before `getDownloaderForPackage` can return it. -#[ignore = "requires shirabe_php_shim::get_class_obj (PHP get_class), still todo!()"] #[test] fn test_get_downloader_for_incorrectly_installed_dist_package() { let package = create_package_mock(); @@ -206,9 +206,6 @@ fn test_get_downloader_for_correctly_installed_source_package() { assert!(std::rc::Rc::ptr_eq(&downloader, &result)); } -// See test_get_downloader_for_incorrectly_installed_dist_package: the LogicException -// path depends on the still-unimplemented get_class_obj shim. -#[ignore = "requires shirabe_php_shim::get_class_obj (PHP get_class), still todo!()"] #[test] fn test_get_downloader_for_incorrectly_installed_source_package() { let package = create_package_mock(); |
