From 381b8f4489773cc68a052944008ac3b05a77ef19 Mon Sep 17 00:00:00 2001 From: ArthurErlich Date: Thu, 28 May 2026 22:09:44 +0200 Subject: [PATCH] docs: add TDD conventions and testing guide to CLAUDE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers testing file conventions, Red→Green→Refactor cycle with example prompts, common anti-patterns, test runner commands, and the auto-run hook setup. Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 046ee28..4c892cb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,6 +16,106 @@ curl "http://localhost:8080/graph.svg?theme=dark" -o graph.svg curl "http://localhost:8080/health" ``` +### Testing conventions (apply to every test file) + +- `declare(strict_types=1)` at the top of every test file +- Test classes are `final` and extend `TestCase` +- Methods: `#[Test]` attribute + `it_` prefix + `snake_case` — e.g. `it_returns_empty_when_no_contributions` +- Structure: Arrange → Act → Assert, separated by blank lines; one assertion per test when possible +- Use `$this->assert*()` not `self::assert*()` + +```php +render([], 'light'); + + $this->assertStringContainsString('&1 | tail -20" + } + ] + } +} +``` + ## Docker ```bash