PHPackages                             jorj-sh/php-test-quality - 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. jorj-sh/php-test-quality

ActiveProject[Testing &amp; Quality](/categories/testing)

jorj-sh/php-test-quality
========================

AST-based test quality analyser for PHPUnit tests

v1.0.0(3mo ago)00MITPHPPHP ^8.4CI passing

Since Mar 24Pushed 3mo agoCompare

[ Source](https://github.com/jorjives/php-test-quality)[ Packagist](https://packagist.org/packages/jorj-sh/php-test-quality)[ RSS](/packages/jorj-sh-php-test-quality/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

php-test-quality
================

[](#php-test-quality)

AST-based test quality analyser for PHPUnit tests. Detects common test smells by parsing PHP test files and walking the abstract syntax tree.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4

Installation
------------

[](#installation)

**PHAR (no Composer needed):**

```
curl -L https://github.com/jorjives/php-test-quality/releases/latest/download/tq.phar -o tq.phar
chmod +x tq.phar
php tq.phar path/to/tests/
```

**Docker (no PHP needed):**

```
docker run --rm -v $(pwd):/code ghcr.io/jorjives/php-test-quality /code/tests/
```

**Composer global:**

```
composer global require jorj-sh/php-test-quality
tq path/to/tests/
```

**Composer dev dependency:**

```
composer require --dev jorj-sh/php-test-quality
vendor/bin/tq path/to/tests/
```

Usage
-----

[](#usage)

```
# Analyse a test directory
tq path/to/tests/

# JSON output
tq path/to/tests/ --format=json

# Run only specific detectors
tq path/to/tests/ --only=no_assertions,assertion_roulette

# List available detectors
tq list-types

# Generate a baseline (requires --reason)
tq path/to/tests/ --generate-baseline --baseline=.tq-baseline.json --reason="Initial baseline"

# Filter using a baseline
tq path/to/tests/ --baseline=.tq-baseline.json
```

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

[](#configuration)

`tq` auto-detects a `.tq.yaml` file in the scan directory. Override with `--config=path/to/.tq.yaml` or skip entirely with `--no-config`. CLI flags always take precedence over config values.

```
thresholds:
  long_test: 40
  magic_number_allowlist:        # replaces default list entirely
    - 0
    - 1
    - 200
    - 404
  magic_number_allowlist_extra:   # appends to active list
    - 42

detectors:
  enabled: all
  disabled:
    - conditional_test_logic

baseline: .tq-baseline.json
```

Detectors
---------

[](#detectors)

TypeNameDescription`no_assertions`Assertion CountTests with no assertions`assertion_roulette`Assertion RouletteMultiple assertions without descriptive messages`constructor_initialization`Constructor InitializationTest classes using `__construct()` instead of `setUp()``empty_test`Empty TestTest methods with no executable statements`sleepy_test`Sleepy TestTests using `sleep()`/`usleep()``redundant_print`Redundant PrintDebug output (`var_dump`, `echo`, etc.) in tests`exception_handling`Exception HandlingTry-catch blocks instead of `expectException()``interface_testing`Interface Testing Anti-PatternsMock-only interface testing`conditional_test_logic`Conditional Test Logic`if`/`switch`/ternary in tests`magic_number_test`Magic Number TestNon-trivial numeric literals in assertions`redundant_assertion`Redundant AssertionTautological assertions like `assertEquals(1, 1)``rotten_green_test`Rotten Green TestAssertions inside conditionals or after return/throw`mystery_guest`Mystery GuestFile I/O or database calls in test bodies`long_test`Long TestTests exceeding 40 linesDocker
------

[](#docker)

```
# Use the published image
docker run --rm -v $(pwd):/code ghcr.io/jorjives/php-test-quality /code/tests/

# Or build locally
docker build -t php-test-quality .
docker run --rm -v /path/to/tests:/tests php-test-quality /tests
```

Licence
-------

[](#licence)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ef3a49bff7663d1811ebb17f785ce6287dcf40ea179230beb483830c830df93?d=identicon)[jorjives](/maintainers/jorjives)

---

Top Contributors

[![jorjives](https://avatars.githubusercontent.com/u/6334477?v=4)](https://github.com/jorjives "jorjives (30 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jorj-sh-php-test-quality/health.svg)

```
[![Health](https://phpackages.com/badges/jorj-sh-php-test-quality/health.svg)](https://phpackages.com/packages/jorj-sh-php-test-quality)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k100.2M2.1k](/packages/behat-behat)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9184.1M24](/packages/phparkitect-phparkitect)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

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