diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-27 17:21:00 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-27 17:26:28 +0900 |
| commit | e98823e599eb375b30037cc714710e3309d927d1 (patch) | |
| tree | e1689ec164086798fc46aa6a58d1e914cf4873b2 /crates/shirabe/tests/command/run_script_command_test.rs | |
| parent | 20f620bdd0b5764ed2e9812dc0772f907b0d6f29 (diff) | |
| download | php-shirabe-e98823e599eb375b30037cc714710e3309d927d1.tar.gz php-shirabe-e98823e599eb375b30037cc714710e3309d927d1.tar.zst php-shirabe-e98823e599eb375b30037cc714710e3309d927d1.zip | |
test: port Composer tests unblocked by mockall, add seams
Port 11 categories of previously-ignored Composer tests now reachable with
the mockall crate: DownloadManager, VCS/Perforce/File downloaders,
VersionSelector, PlatformRepository, Auditor, installer/FilesystemRepository,
RootPackageLoader, util auth/http, commands, and Cache.
Extract test seams additively on concrete structs as *Interface traits
(Runtime, HhvmDetector, VersionGuesser, RepositorySet, Perforce,
BinaryInstaller) plus mock-field seams (Cache, Filesystem); consumers take
trait objects. Mocks are defined locally in the test crates via
mockall::mock!, since automock-generated mocks are cfg(test)-gated and
invisible across the integration-test boundary.
dataProviders are ported in full; tests blocked by unported shims stay
#[ignore] with documented reasons rather than reduced or weakened.
Fix product bugs surfaced by the ports:
- util/github: use the exception code, not the HTTP status, for 401/403
- advisory: serialize empty audit maps as [] to match PHP json_encode
- repository/filesystem and downloader/file: fix RefCell double-borrow panics
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/command/run_script_command_test.rs')
| -rw-r--r-- | crates/shirabe/tests/command/run_script_command_test.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/shirabe/tests/command/run_script_command_test.rs b/crates/shirabe/tests/command/run_script_command_test.rs index 8e96cf3..6cd4a2e 100644 --- a/crates/shirabe/tests/command/run_script_command_test.rs +++ b/crates/shirabe/tests/command/run_script_command_test.rs @@ -1,11 +1,21 @@ //! ref: composer/tests/Composer/Test/Command/RunScriptCommandTest.php +use shirabe_php_shim::PhpMixed; + use crate::test_case::{RunOptions, get_application_tester, init_temp_composer}; use serial_test::serial; -use shirabe_php_shim::PhpMixed; +/// ref: RunScriptCommandTest::testDetectAndPassDevModeToEventAndToDispatching +/// +/// The `getDevOptions` dataProvider drives four `(dev, noDev)` cases; for each, PHP asserts that the +/// `ScriptEvent` passed to `hasEventListeners` matches the script name AND its `isDevMode()` equals +/// the computed dev mode (`dev || !noDev`) -- the latter being the whole point of the test. #[test] -#[ignore = "requires PHPUnit getMockBuilder/onlyMethods partial mock of RunScriptCommand (override requireComposer/initialize/etc) plus expects()/with()/willReturn()/returnValueMap mocks of InputInterface/OutputInterface/EventDispatcher with a callback constraint on ScriptEvent; no mocking infrastructure exists"] +#[ignore = "PHP asserts the ScriptEvent passed to hasEventListeners has isDevMode() == (dev || !no_dev), \ + but EventInterface (src/event_dispatcher/event.rs:49) has no as_any/downcast seam, so a \ + trait object cannot reach the concrete ScriptEvent::is_dev_mode (src/script/event.rs:51). \ + Reaching it would require adding as_any to EventInterface, i.e. a src change, which is \ + forbidden here -- so the faithful body is currently inexpressible and is left as todo!()."] fn test_detect_and_pass_dev_mode_to_event_and_to_dispatching() { todo!() } |
