PHPackages                             gustavorah/legacy-test-suite - 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. gustavorah/legacy-test-suite

ActiveLibrary

gustavorah/legacy-test-suite
============================

CLI tool to manage PHPUnit test suites in legacy PHP systems

1.0.0(today)01↑2900%MITPHPPHP ^7.4|^8.0

Since Mar 24Pushed todayCompare

[ Source](https://github.com/gustavorah/legacy-test-suite)[ Packagist](https://packagist.org/packages/gustavorah/legacy-test-suite)[ RSS](/packages/gustavorah-legacy-test-suite/feed)WikiDiscussions main Synced today

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

legacy-test-suite
=================

[](#legacy-test-suite)

CLI tool to manage PHPUnit test suites in legacy PHP systems. Instead of maintaining a complex `phpunit.xml` by hand, you declare modules and tests in a simple `legacy-tests.json` file and run them selectively.

---

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

[](#installation)

```
composer require --dev gustavorah/legacy-test-suite
```

---

Getting started
---------------

[](#getting-started)

### 1. Initialize the configuration file

[](#1-initialize-the-configuration-file)

Run this once in the root of your project:

```
vendor/bin/legacy-test init
```

This creates `legacy-tests.json` in your project root.

### 2. Add a module

[](#2-add-a-module)

A **module** groups related test files (e.g. by domain or subsystem).

```
vendor/bin/legacy-test module:add financeiro --description="Módulo financeiro do sistema"
```

By default the directory will be `tests/`. Override it with `--directory`:

```
vendor/bin/legacy-test module:add financeiro \
  --description="Módulo financeiro" \
  --directory="tests/Finance"
```

### 3. Add test classes to a module

[](#3-add-test-classes-to-a-module)

```
vendor/bin/legacy-test add financeiro CalculoJurosTest
vendor/bin/legacy-test add financeiro BoletoTest
vendor/bin/legacy-test add financeiro RelatorioFinanceiroTest
```

Use the class name **without** the `.php` extension.

### 4. Run the tests

[](#4-run-the-tests)

```
# Run a single module
vendor/bin/legacy-test run financeiro

# Run all enabled modules at once
vendor/bin/legacy-test run --all
```

---

Configuration file: `legacy-tests.json`
---------------------------------------

[](#configuration-file-legacy-testsjson)

The file lives at the root of the user's project:

```
{
  "version": "1.0",
  "phpunit_binary": "vendor/bin/phpunit",
  "tests_directory": "tests",
  "modules": {
    "financeiro": {
      "enabled": true,
      "description": "Módulo financeiro do sistema",
      "directory": "tests/financeiro",
      "tests": ["CalculoJurosTest", "BoletoTest", "RelatorioFinanceiroTest"]
    },
    "estoque": {
      "enabled": true,
      "description": "Controle de estoque e inventário",
      "directory": "tests/estoque",
      "tests": ["EntradaMercadoriaTest", "SaidaEstoqueTest"]
    }
  }
}
```

---

Command reference
-----------------

[](#command-reference)

### `init`

[](#init)

Initialize `legacy-tests.json` in the current directory.

```
vendor/bin/legacy-test init
```

---

### `module:add `

[](#moduleadd-name)

Add a new module.

```
vendor/bin/legacy-test module:add financeiro --description="Módulo financeiro"
vendor/bin/legacy-test module:add rh --description="Recursos humanos" --directory="tests/HR"
```

OptionDescription`--description`, `-d`Human-readable description`--directory`Path to the test directory (default: `tests/`)---

### `module:remove `

[](#moduleremove-name)

Remove a module and all its registered tests. Asks for confirmation.

```
vendor/bin/legacy-test module:remove financeiro
```

---

### `module:enable ` / `module:disable `

[](#moduleenable-name--moduledisable-name)

Enable or disable a module without removing it. Disabled modules are skipped in `run --all`.

```
vendor/bin/legacy-test module:enable financeiro
vendor/bin/legacy-test module:disable estoque
```

---

### `add  `

[](#add-module-testclass)

Register a test class in a module.

```
vendor/bin/legacy-test add financeiro CalculoJurosTest
vendor/bin/legacy-test add estoque EntradaMercadoriaTest
```

---

### `remove  `

[](#remove-module-testclass)

Unregister a test class from a module.

```
vendor/bin/legacy-test remove financeiro CalculoJurosTest
```

---

### `list`

[](#list)

Display a formatted table of all modules and their tests.

```
vendor/bin/legacy-test list
```

Output example:

```
 ──────────────────────────────────────────────────────────────
  Module      Status     Tests  Description         Directory
 ──────────────────────────────────────────────────────────────
  financeiro  ✓ enabled  3      Módulo financeiro   tests/financeiro
  estoque     ✗ disabled 2      Controle de estoque tests/estoque
 ──────────────────────────────────────────────────────────────

```

---

### `status`

[](#status)

Show a summary: total modules, enabled/disabled count, total tests, config path.

```
vendor/bin/legacy-test status
```

---

### `run `

[](#run-module)

Run all tests registered in a specific module.

```
vendor/bin/legacy-test run financeiro
```

---

### `run --all`

[](#run---all)

Run all **enabled** modules.

```
vendor/bin/legacy-test run --all
```

A temporary `.legacy-test-phpunit.xml` file is generated before the run and deleted automatically afterwards.

---

How the XML generation works
----------------------------

[](#how-the-xml-generation-works)

When you run a module, a temporary `phpunit.xml` is generated at `.legacy-test-phpunit.xml`:

- If the module has explicit test entries → uses `` elements
- If the module has no entries → uses `` (PHPUnit discovers all tests in that folder)

```

            tests/financeiro/CalculoJurosTest.php
            tests/financeiro/BoletoTest.php

            tests/estoque

```

---

Real-world workflow example
---------------------------

[](#real-world-workflow-example)

Imagine a legacy e-commerce system where you want to start adding tests incrementally without breaking the existing (absent) CI:

```
# 1. Enter the legacy project
cd /var/www/legacy-ecommerce

# 2. Install the tool
composer require --dev gustavorah/legacy-test-suite

# 3. Bootstrap
vendor/bin/legacy-test init

# 4. Create the first module for the most critical subsystem
vendor/bin/legacy-test module:add pedidos \
  --description="Fluxo de criação e pagamento de pedidos" \
  --directory="tests/Pedidos"

# 5. Register tests as you write them
vendor/bin/legacy-test add pedidos CriarPedidoTest
vendor/bin/legacy-test add pedidos PagamentoCartaoTest
vendor/bin/legacy-test add pedidos CancelamentoPedidoTest

# 6. Run only these tests (fast, isolated)
vendor/bin/legacy-test run pedidos

# 7. Add a second module for a subsystem still under development
vendor/bin/legacy-test module:add notificacoes \
  --description="E-mails e SMS transacionais"

vendor/bin/legacy-test add notificacoes EmailConfirmacaoTest

# 8. Temporarily disable it while it's still unstable
vendor/bin/legacy-test module:disable notificacoes

# 9. Run everything that is stable
vendor/bin/legacy-test run --all

# 10. Check the big picture at any time
vendor/bin/legacy-test status
vendor/bin/legacy-test list
```

This lets you grow the test coverage organically without touching `phpunit.xml` directly or running unrelated failing tests.

---

Running the library's own tests
-------------------------------

[](#running-the-librarys-own-tests)

```
composer install
vendor/bin/phpunit tests/
```

---

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

[](#requirements)

- PHP 7.4 or 8.x
- PHPUnit 9.x or 10.x
- Symfony Console 5.x, 6.x, or 7.x

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4927c4c1a1ff7a73c1691090df37d09871ceba3acff1dcf15e241631ea002609?d=identicon)[gusrah](/maintainers/gusrah)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gustavorah-legacy-test-suite/health.svg)

```
[![Health](https://phpackages.com/badges/gustavorah-legacy-test-suite/health.svg)](https://phpackages.com/packages/gustavorah-legacy-test-suite)
```

###  Alternatives

[codeception/codeception

All-in-one PHP Testing Framework

4.9k84.8M2.8k](/packages/codeception-codeception)[kocal/symfony-mailer-testing

Test your emails with Behat and Cypress, when using the Symfony Mailer component.

15253.0k](/packages/kocal-symfony-mailer-testing)

PHPackages © 2026

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