Skip to content

chore: enforce camelCase PHPUnit method names - #95

Merged
loks0n merged 1 commit into
mainfrom
chore/enforce-camelcase-test-methods
Jul 27, 2026
Merged

chore: enforce camelCase PHPUnit method names#95
loks0n merged 1 commit into
mainfrom
chore/enforce-camelcase-test-methods

Conversation

@loks0n

@loks0n loks0n commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Every package except image already used camelCase test method names, so the convention existed by habit rather than by rule — nothing stopped it drifting back.

pint.json gains one rule:

"php_unit_method_casing": {
    "case": "camel_case"
}

Now the wrong form is corrected on write rather than waiting for someone to notice it in review.

What it changes

Turning the rule on renames image's 39 test methods, which is the rest of the diff:

test_jpeg                  -> testJpeg
test_crop100x100           -> testCrop100x100
test_crop_gravity_nw       -> testCropGravityNw
test_webp_blob_output      -> testWebpBlobOutput
...

Nothing references them by name — the file's only #[DataProvider] names a provider method, not a test — and there are no @depends, no string references and no phpunit.xml filters. The suite passes unchanged: 56 tests, 358 assertions.

Pint also reported braces_position and single_line_empty_body on that file, but those only touch the signature lines it was already rewriting. The diff is renames.

Verified

  • vendor/bin/pint --test passes repo-wide, and passed on main beforehand too, so the rule is the only thing this introduces
  • bin/monorepo check image, test image and validate all pass
  • No public function test_ remains anywhere in packages/*/tests

Note

I originally raised this thinking pools also had snake_case methods. It does not — pools was already camelCase on main, and image is the only package that needed fixing.

🤖 Generated with Claude Code

Every package but image already named its test methods in camelCase, so
the convention existed by habit rather than by rule and nothing stopped it
drifting. Pint's php_unit_method_casing fixer settles it: the wrong form
is corrected on write instead of waiting for someone to spot it in review.

Turning the rule on renames image's 39 test methods, which is the whole of
the rest of this change. Nothing references them by name — the only
DataProvider attribute names a provider, not a test — and the suite passes
unchanged at 56 tests and 358 assertions.

Pint reported braces_position and single_line_empty_body alongside the
casing fixer, but those touch only the signature lines it was already
rewriting; the diff is renames.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@loks0n
loks0n merged commit 3119fd7 into main Jul 27, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant