Skip to content

ParityProve every production file has a worthy test.

A release gate that compares source structure, declared coverage intent, and real coverage output before weak test architecture reaches CI.

Static test architecture checks for teams that ship PHP

Coverage is not enough when it comes from the wrong test.

Parity reads the coverage reports you already generate and answers the hand-off question reviewers actually care about: does this source file have the right test, does that test claim ownership, and did it cover meaningful executable lines?

0 test execution3 coverage formats5 built-in rules
php parity check --format=json
{
  "passed": true,
  "global_coverage": 71.88,
  "min_coverage_global": 60,
  "structures": [
    {
      "name": "Services",
      "files": [
        {
          "source": "app/Services/ParityChecker.php",
          "test": "tests/Unit/Services/ParityCheckerTest.php",
          "passed": true,
          "rules": {
            "test-exists": { "value": "Y" },
            "minimum-coverage": { "value": "68.33%" },
            "matched-coverage": { "value": "68.33%" }
          }
        }
      ]
    }
  ]
}

What the gate catches

Not just “is coverage high?” but “is coverage accountable?”

01

Missing test files

Every source path resolves to an expected test path, with explicit file maps for real-world exceptions.

02

Weak ownership

Pest ->covers() and PHPUnit #[CoversClass] declarations are validated statically.

03

Incidental coverage

PHPUnit XML attribution lets Parity distinguish matching-test coverage from accidental coverage.

04

CI regressions

Machine-readable JSON and deterministic exit codes make Parity a straightforward release gate.

Release workflow

Generate coverage. Run Parity. Ship with a structural receipt.

  1. ConfigureMap source folders to test folders in parity.yaml.
  2. MeasureEmit PHPUnit XML, Clover XML, or Cobertura XML from your native test tool.
  3. EnforceFail CI when tests disappear, ownership declarations drift, or coverage drops.

Dogfoods itself

The Parity repository now runs php parity check --format=json against its own production code in CI.

Works across report formats

Use rich PHPUnit XML attribution when available, or portable Clover and Cobertura reports when integrating other stacks.

Extensible by design

Add project-local, user-global, or Composer-distributed rules without forking the core checker.