PHPUnit CI job fails (exit code 1) for every test class despite all assertions passing
## Problem The `phpunit` CI job fails on merge requests even though every individual test **passes all its assertions**. Observed on [!300](https://git.drupalcode.org/project/ai_agents/-/merge_requests/300), pipeline https://git.drupalcode.org/project/ai_agents/-/pipelines/888950, job https://git.drupalcode.org/project/ai_agents/-/jobs/10938828. The `run-tests.sh` summary shows every single test class in the module — not just ones touched by the MR — finishing with all tests passed but a non-zero subprocess exit code: ``` 3.173s Drupal\Tests\ai_agents\Functional\AiAgentsMenuLinkTest 1 passed, exit code 1 5.604s …ai_agents\Kernel\Plugin\AiFunctionCall\ListFieldDisplayTypesTest 6 passed, exit code 1 6.601s …ai_agents\Kernel\PluginBase\AiAgentExternallyDrivenLoopTest 7 passed, exit code 1 6.715s Drupal\Tests\ai_agents\Kernel\PluginBase\AiAgentEntityWrapperTest 8 passed, exit code 1 ... (every remaining test class, same pattern) ``` Drilling into any one class's detailed output, PHPUnit itself reports success, just with deprecation notices: ``` Tests: 1, Assertions: 8, Deprecations: 33, PHPUnit Deprecations: 2. OK, but there were issues! ``` i.e. PHPUnit prints "OK, but there were issues!" (exit code normally 0 for that state) yet the wrapping `run-tests.sh` subprocess exits 1, which fails the whole CI job. This happens across unrelated test classes (`VisionTest`, `ListFieldTypesTest`, `AiAgentStatusPollerServiceTest`, etc.), so it is not caused by the MR's actual test changes — it looks like an environment/tooling issue where deprecations (many pointing at Drupal core 11.3–11.5 deprecations, e.g. `cache.static`, `SYMFONY_DEPRECATIONS_HELPER`, `#[RunTestsInSeparateProcesses]`, `#[LegacyRequirementsHook]`, plus 2 "PHPUnit Deprecations" per class) are being treated as a failing exit code somewhere in the run-tests.sh / PHPUnit 11.5.56 interaction, even though the human-readable summary says "OK, but there were issues!". ## Steps to reproduce 1. Open any current MR against `ai_agents` and let the `phpunit` CI job run (or run locally against Drupal core 11.4-dev / PHPUnit 11.5.56). 2. Observe the job fails, but the detailed per-class output shows all tests passing with only deprecation notices. ## Impact Every MR against this module currently shows a failing `phpunit` CI job regardless of the actual code change, which masks real regressions and blocks the normal "CI green" merge signal. ## Environment - Drupal core: 11.4-dev (`DRUPAL_CORE=11.x-dev`) - PHPUnit: 11.5.56 - PHP: 8.3.32 - CI image: `php-8.3-ubuntu-apache:production` (DrupalCI) ## Proposed next step Confirm whether this is caused by deprecations from Drupal core 11.3–11.5 (`cache.static`, `SYMFONY_DEPRECATIONS_HELPER`, missing `#[RunTestsInSeparateProcesses]`/`#[LegacyRequirementsHook]` attributes) being escalated to a failing exit code by `run-tests.sh` under PHPUnit 11.5.56, and either fix the deprecations at the source or adjust the CI test invocation so deprecation-only runs do not fail the job.
issue