PHPackages                             babu-ch/phpcs-aaa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. babu-ch/phpcs-aaa

ActivePhpcodesniffer-standard[Testing &amp; Quality](/categories/testing)

babu-ch/phpcs-aaa
=================

PHP\_CodeSniffer standard that enforces the Arrange-Act-Assert pattern in test code.

0.0.2(1mo ago)00MITPHPPHP &gt;=7.4

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/babu-ch/phpcs-aaa)[ Packagist](https://packagist.org/packages/babu-ch/phpcs-aaa)[ Docs](https://babu-ch.github.io/aaa-lint/guide/phpcs)[ RSS](/packages/babu-ch-phpcs-aaa/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

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-aaa` repo, that is a **read-only split mirror** distributed via Packagist. Source, issues, and pull requests live in the parent monorepo: .

Install
-------

[](#install)

```
composer require --dev babu-ch/phpcs-aaa
```

If you are not using the [phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer), point PHPCS at the standard manually:

```
vendor/bin/phpcs --config-set installed_paths vendor/babu-ch/phpcs-aaa
```

Usage
-----

[](#usage)

Add to your `phpcs.xml.dist`:

```

    tests

```

Or run directly:

```
vendor/bin/phpcs --standard=AAA tests/
```

What it checks
--------------

[](#what-it-checks)

Every test method (name starting with `test` by default, per PHPUnit convention) must contain three marker comments in order:

```
public function testAdds(): void
{
    // arrange
    $a = 1;
    $b = 2;

    // act
    $sum = $a + $b;

    // assert
    $this->assertSame(3, $sum);
}
```

Configuration
-------------

[](#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

[](#given--when--then)

```

```

Auto-fix
--------

[](#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
-----------

[](#development)

```
composer install
composer test
```

Tests use PHPUnit against the PHPCS Ruleset/DummyFile API directly (no fixture file dance).

License
-------

[](#license)

MIT

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance89

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/85a4eef0b90c4ba12d9acc00a815ee4cac70b8fcfc4cde6b7253763812c15120?d=identicon)[babch](/maintainers/babch)

---

Top Contributors

[![babu-ch](https://avatars.githubusercontent.com/u/42715882?v=4)](https://github.com/babu-ch "babu-ch (9 commits)")

---

Tags

phpcsphpunittestaaaarrange-act-assert

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/babu-ch-phpcs-aaa/health.svg)

```
[![Health](https://phpackages.com/badges/babu-ch-phpcs-aaa/health.svg)](https://phpackages.com/packages/babu-ch-phpcs-aaa)
```

###  Alternatives

[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k130.4M2.1k](/packages/slevomat-coding-standard)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598170.6M2.2k](/packages/dealerdirect-phpcodesniffer-composer-installer)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10953.8M18](/packages/ta-tikoma-phpunit-architecture-test)[kenjis/ci-phpunit-test

An easier way to use PHPUnit with CodeIgniter 3.x

5961.2M3](/packages/kenjis-ci-phpunit-test)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.7M508](/packages/php-mock-php-mock-phpunit)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1489.3M94](/packages/ergebnis-phpunit-slow-test-detector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
