diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 17:02:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-26 00:20:05 +0900 |
| commit | 3498bb1ca00ab7d051d296b8d482bea987a00fa4 (patch) | |
| tree | e10260e5816317f4547847e2a230ea1a87fb2448 /crates/shirabe/tests/command/clear_cache_command_test.rs | |
| parent | 291b43d132749a61918dca23acef1b639c5333a7 (diff) | |
| download | php-shirabe-3498bb1ca00ab7d051d296b8d482bea987a00fa4.tar.gz php-shirabe-3498bb1ca00ab7d051d296b8d482bea987a00fa4.tar.zst php-shirabe-3498bb1ca00ab7d051d296b8d482bea987a00fa4.zip | |
test: port 24 command/repository/package/util tests; add TlsHelper
Port command (9), util gitlab/forgejo/tls (6), package (6), repository (3)
tests. Implement TlsHelper. Fix porting bugs: config_command extra merge,
RootAliasPackage setters, ValidatingArrayLoader isset, repository_factory name
generation, forgejo exception code, version_parser error chaining.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/command/clear_cache_command_test.rs')
| -rw-r--r-- | crates/shirabe/tests/command/clear_cache_command_test.rs | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/crates/shirabe/tests/command/clear_cache_command_test.rs b/crates/shirabe/tests/command/clear_cache_command_test.rs index 4ad04dd..b185579 100644 --- a/crates/shirabe/tests/command/clear_cache_command_test.rs +++ b/crates/shirabe/tests/command/clear_cache_command_test.rs @@ -1,6 +1,9 @@ //! ref: composer/tests/Composer/Test/Command/ClearCacheCommandTest.php +use crate::test_case::{RunOptions, get_application_tester}; +use serial_test::serial; use shirabe::util::platform::Platform; +use shirabe_php_shim::PhpMixed; fn tear_down() { // --no-cache triggers the env to change so make sure the env is cleaned up after these tests run @@ -16,25 +19,76 @@ impl Drop for TearDown { } #[test] -#[ignore = "ApplicationTester / get_application_tester helper not implemented"] +#[serial] fn test_clear_cache_command_success() { let _tear_down = TearDown; - todo!() + let mut app_tester = get_application_tester(); + app_tester + .run( + vec![(PhpMixed::from("command"), PhpMixed::from("clear-cache"))], + RunOptions::default(), + ) + .unwrap(); + + assert_eq!(0, app_tester.get_status_code()); + + let output = app_tester.get_display(); + assert!( + output.contains("All caches cleared."), + "expected output to contain 'All caches cleared.', got: {:?}", + output, + ); } #[test] -#[ignore = "ApplicationTester / get_application_tester helper not implemented"] +#[serial] fn test_clear_cache_command_with_option_garbage_collection() { let _tear_down = TearDown; - todo!() + let mut app_tester = get_application_tester(); + app_tester + .run( + vec![ + (PhpMixed::from("command"), PhpMixed::from("clear-cache")), + (PhpMixed::from("--gc"), PhpMixed::Bool(true)), + ], + RunOptions::default(), + ) + .unwrap(); + + assert_eq!(0, app_tester.get_status_code()); + + let output = app_tester.get_display(); + assert!( + output.contains("All caches garbage-collected."), + "expected output to contain 'All caches garbage-collected.', got: {:?}", + output, + ); } #[test] -#[ignore = "ApplicationTester / get_application_tester helper not implemented"] +#[serial] fn test_clear_cache_command_with_option_no_cache() { let _tear_down = TearDown; - todo!() + let mut app_tester = get_application_tester(); + app_tester + .run( + vec![ + (PhpMixed::from("command"), PhpMixed::from("clear-cache")), + (PhpMixed::from("--no-cache"), PhpMixed::Bool(true)), + ], + RunOptions::default(), + ) + .unwrap(); + + assert_eq!(0, app_tester.get_status_code()); + + let output = app_tester.get_display(); + assert!( + output.contains("Cache is not enabled"), + "expected output to contain 'Cache is not enabled', got: {:?}", + output, + ); } |
