Clean up CCC test and documentation consistency before rc1
## Problem/motivation Follow-up to: #3586258+s Parent: #3586298+s _**Verify the issue problem and solution before proceeding.**_ **7. Test Quality And Test Documentation** **Priority:** Medium **Why group these together:** These fixes improve test reliability and signal without changing production behavior. They are low-risk cleanup items suitable for pre-rc1. **Scope:** - **7.1** Standardize `#[RunTestsInSeparateProcesses]` on all Kernel, Functional, and FunctionalJavascript test classes (follow-up to #3586280). - **7.2** Replace documentation-only and introspection-only unit tests with assertions that exercise real behavior. - **7.4** Add `SIMPLETEST_BASE_URL` / `SIMPLETEST_DB` guidance to `tests/README.md`, aligned with `docs/contribute/testing.md`. **Moved to follow-up issues:** - **7.3** Functional test dual-container traps → #3586325 - **7.5** Accessibility test coverage → #3586326 ## Solution ### 7.1 Make integration-test process metadata consistent **Files:** - `tests/README.md` - Kernel, Functional, and FunctionalJavascript test classes **Problem:** The module documents PHPDoc `@runTestsInSeparateProcesses` as the convention for cross-version compatibility, but current tests use mixed styles and many integration tests may lack either PHPDoc or PHP 8 attribute metadata. **Recommended fix:** - Decide on the convention while Drupal 10.5 support remains. - Apply it consistently to all Kernel, Functional, and FunctionalJavascript test classes. - Once Drupal 10.5/PHPUnit 9 compatibility is dropped, consider migrating to PHP 8 attributes in one follow-up. ### 7.2 Replace documentation-only and introspection-only tests **Files:** - `tests/src/Unit/AiContextScopeGlobalTest.php` - `tests/src/Unit/AiContextItemTranslationHandlerTest.php` - related unit tests that duplicate production logic **Problem:** Some tests assert `TRUE`, test only `method_exists()` / `is_subclass_of()`, or copy production algorithms into test helpers. These tests can pass while behavior regresses. **Recommended fix:** - Replace documentation-only assertions with calls to the actual methods under test. - Move tests to Kernel tests when real Drupal services/entities are required. - Avoid duplicating production algorithms in test helpers. - Keep test names intent-first. ### ~~7.3 Avoid functional-test dual-container traps~~ **(moved to own issue)** **File:** - ~~`tests/src/Functional/AiContextAdminSettingsTest.php`~~ **Problem:** ~~At least one functional test submits a form directly through the test container's `form_builder`. Functional tests run separate test and web-server containers, so direct form builder submission can miss browser/runtime behavior.~~ **Recommended fix:** - ~~Use `$this->drupalGet()` and browser-level `$this->submitForm()` when testing user-facing forms.~~ - ~~If direct form API testing is intentional, move that coverage to a Kernel test or document why direct submission is appropriate.~~ **MOVED TO OWN ISSUE:** #3586325+s ### 7.4 Add missing test environment guidance to `tests/README.md` **Files:** - `tests/README.md` - optionally `docs/contribute/testing.md` **Problem:** `docs/contribute/testing.md` documents `SIMPLETEST_BASE_URL` and `SIMPLETEST_DB`, but `tests/README.md` does not. Developers following only the test README can hit setup failures. **Recommended fix:** - Add the DDEV `SIMPLETEST_BASE_URL` and `SIMPLETEST_DB` values to `tests/README.md`. - Or link directly from `tests/README.md` to `docs/contribute/testing.md`. ### ~~7.5 Add basic accessibility test coverage~~ **(moved to own issue)** **Files:** - ~~FunctionalJavascript tests or a focused accessibility test suite~~ **Problem:** ~~No accessibility or axe-style assertions were found in the test suite.~~ **Recommended fix:** - ~~Add focused coverage for the pages changed by the accessibility fixes: context item list, agents overview, and overview page.~~ - ~~At minimum, test `Drupal.announce()` behavior for filters and visible labels for tooltip/truncated content.~~ **MOVED TO OWN ISSUE:** #3586326+s ## AI usage - [x] AI assisted issue
issue