From 1eaa22a226a5ff555fad3b56b1dfba6ea0849ab2 Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 6 Oct 2026 09:01:56 +0200 Subject: [PATCH] docs: add test-method naming convention to AGENTS.md (#4735) Name test methods test{MethodUnderTest}_{Behavior} (e.g. testPostSave_RejectsNegativeTaxPercent) so they read as a self-documenting sentence and need no docblock. --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index bbca08c83..d423d2acd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,6 +27,7 @@ This document provides guidance for AI agents working on the Open Source Point o - Run PHPUnit tests: `composer test` - Tests must pass before submitting changes - **One test file per class under test.** A controller, model, library, or helper gets exactly one test file covering all of its behavior — `Item_kits.php` → `tests/Controllers/Item_kitsTest.php` (or `Item_kitsControllerTest.php`, matching this codebase's existing `*ControllerTest.php` suffix for controllers), `Sale_lib.php` → `tests/Libraries/Sale_libTest.php`, etc. Do not create feature- or endpoint-scoped test files alongside a class's main test file (e.g. no `Item_kitsBarcodeTest.php` next to `Item_kitsControllerTest.php`) — add the new test methods to the existing file for that class instead. If no test file exists yet for the class, create the one canonical file rather than a narrowly-scoped one. +- **Name test methods as `test{MethodUnderTest}_{Behavior}`.** `PascalCase` the method under test, then an underscore, then a short behavior phrase — `testPostSave_RejectsNegativeTaxPercent`, `testSaveLocale_AcceptsValidReferenceCodeMinMax`. Start the behavior with a verb: `Accepts`/`Requires` for valid or boundary cases, `Rejects` for invalid ones. The name should read as a self-documenting sentence and needs no docblock. ## Build