Download the PHP package babu-ch/phpcs-aaa without Composer
On this page you can find all versions of the php package babu-ch/phpcs-aaa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download babu-ch/phpcs-aaa
More information about babu-ch/phpcs-aaa
Files in babu-ch/phpcs-aaa
Package phpcs-aaa
Short Description PHP_CodeSniffer standard that enforces the Arrange-Act-Assert pattern in test code.
License MIT
Homepage https://babu-ch.github.io/aaa-lint/guide/phpcs
Informations about the package phpcs-aaa
phpcs-aaa
PHP_CodeSniffer standard that enforces the Arrange-Act-Assert pattern in PHP test methods.
Heads up: if you are reading this on the
babu-ch/phpcs-aaarepo, that is a read-only split mirror distributed via Packagist. Source, issues, and pull requests live in the parent monorepo: https://github.com/babu-ch/aaa-lint.
Install
If you are not using the phpcodesniffer-composer-installer, point PHPCS at the standard manually:
Usage
Add to your phpcs.xml.dist:
Or run directly:
What it checks
Every test method (name starting with test by default, per PHPUnit convention) must contain three marker comments in order:
Configuration
Override properties in your ruleset:
Note: the labels property via XML only accepts scalar values per key. For multiple synonyms (e.g. Japanese 準備 / 前準備), configure via a custom sniff subclass or a PHP-based ruleset at the moment.
Given / When / Then
Auto-fix
When all three section comments are missing, vendor/bin/phpcbf (the auto-fixer that ships with PHP_CodeSniffer) inserts a // arrange / // act / // assert template at the top of the test method. You then move each comment above the code that belongs to it.
Other cases — one or two sections missing, wrong order, empty section — are reported with explicit hints in the error message but are not auto-fixed, because the correct insertion point depends on the test's intent.
Development
Tests use PHPUnit against the PHPCS Ruleset/DummyFile API directly (no fixture file dance).
License
MIT