From fdd60a0a66890e049fea3db5c619e64e67e225df Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 04:01:40 +0900 Subject: test(event-dispatcher): run PHPUnit-class listeners in the PHP worker The listeners of five tests are methods of `Composer\Test\EventDispatcher\EventDispatcherTest`, which the worker could not load because the class extends `PHPUnit\Framework\TestCase` and phpunit is not part of the Composer runtime bundle. An empty stand-in for that base class is enough: a parent class only has to exist at declaration time, and method bodies and type declarations resolve lazily. The upstream file is then required into the worker unchanged, so the listener bodies and their `__DIR__` stay what Composer ships. The two assertions those bodies call are the only PHPUnit members the stand-in has to implement. `remove_listener` now compares a handle for an object the worker really holds instead of a hand-written one, and `create_composer_instance` wires the collaborators the autoloader-rebuild path reaches for, as the PHP helper does. Two tests stay ignored for a different reason: `Platform::put_env` writes only the Shirabe process environment, while the listeners read `getenv()` inside the long-lived worker. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/tests/event_dispatcher/main.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'crates/shirabe/tests/event_dispatcher/main.rs') diff --git a/crates/shirabe/tests/event_dispatcher/main.rs b/crates/shirabe/tests/event_dispatcher/main.rs index f51b0f2d..a17270ca 100644 --- a/crates/shirabe/tests/event_dispatcher/main.rs +++ b/crates/shirabe/tests/event_dispatcher/main.rs @@ -2,6 +2,8 @@ mod io_mock; #[path = "../common/io_stub.rs"] mod io_stub; +#[path = "../common/php_worker.rs"] +mod php_worker; #[path = "../common/process_executor_mock.rs"] mod process_executor_mock; -- cgit v1.3.1-4-g156e