PHPackages                             team-mate-pro/tests-bundle - 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. team-mate-pro/tests-bundle

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

team-mate-pro/tests-bundle
==========================

Testing utilities and helpers for Symfony test environment

1.26.0(1mo ago)06.6k↓32.6%4MITPHPPHP &gt;=8.2

Since Nov 19Pushed 1mo agoCompare

[ Source](https://github.com/team-mate-pro/tests-bundle)[ Packagist](https://packagist.org/packages/team-mate-pro/tests-bundle)[ RSS](/packages/team-mate-pro-tests-bundle/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (31)Versions (23)Used By (4)

Tests Bundle
============

[](#tests-bundle)

Testing utilities and helpers for Symfony test environment.

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

[](#installation)

```
composer require team-mate-pro/tests-bundle --dev
```

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

[](#requirements)

- PHP &gt;= 8.2
- Symfony &gt;= 6.4

Features
--------

[](#features)

### Console Commands

[](#console-commands)

#### `tmp:tests` - Test Runner

[](#tmptests---test-runner)

Runs `tests:warmup` (if defined in `composer.json`) and then executes PHPUnit. Provides colored output, re-run failed tests, and code coverage enforcement.

**Usage:**

```
php bin/console tmp:tests
php bin/console tmp:tests --failed
php bin/console tmp:tests --coverage=80
php bin/console tmp:tests --suite unit
php bin/console tmp:tests --suite unit --suite integration
php bin/console tmp:tests --group fast
php bin/console tmp:tests --group fast --exclude-group flaky
php bin/console tmp:tests --parallel=4
php bin/console tmp:tests --no-warmup
```

**Options:**

OptionDescription`--failed`Re-run only previously failed tests. Once they all pass, the defect list is cleared automatically.`--coverage=N`Generate code coverage and fail if the line coverage percentage is below `N` (1-100).`--suite=NAME`Run only the specified test suite(s). Can be repeated to run multiple suites. Maps to PHPUnit's `--testsuite` option.`--group=NAME`Run only tests in the specified group(s). Can be repeated. Maps to PHPUnit's `--group` option.`--exclude-group=NAME`Exclude tests in the specified group(s). Can be repeated. Maps to PHPUnit's `--exclude-group` option.`--parallel=N`Run tests in parallel using N processes. Requires ParaTest (see below).`--no-warmup`Skip `tests:warmup` step. Useful for unit tests that run in isolation without database setup.All options can be combined. For example, `--suite integration --group fast --exclude-group flaky` runs only the `integration` suite, includes only tests in the `fast` group, and excludes tests in the `flaky` group.

**How `--failed` works:**

PHPUnit 10+ stores test results in `.phpunit.cache/test-results` (JSON). The command reads this file, extracts defect names (stripping data-set suffixes for deduplication), and passes them as a `--filter` to PHPUnit. After a successful re-run, defects are cleared so the next `--failed` invocation reports "No previously failed tests found".

**How `--coverage` works:**

Passes `--coverage-clover` to PHPUnit, then parses the generated Clover XML to calculate line coverage (`coveredstatements / statements * 100`). If `` is configured in `phpunit.xml`, uses that path instead of generating a temporary file.

**How `--parallel` works:**

The `--parallel` option uses [ParaTest](https://github.com/paratestphp/paratest) to run tests in multiple processes simultaneously. ParaTest:

1. Scans all test files and distributes them across N processes
2. Runs each process with its own PHPUnit instance
3. Aggregates results from all processes into a single report
4. Merges coverage reports (when using `--coverage`)

**Installing ParaTest:**

```
composer require --dev brianium/paratest
```

**Performance comparison:**

CommandProcessesTime (example)`tmp:tests`1~60s`tmp:tests --parallel=2`2~32s`tmp:tests --parallel=4`4~18s`tmp:tests --parallel=8`8~12s#### `tmp:tests:verify-setup` - Setup Verification

[](#tmptestsverify-setup---setup-verification)

Validates that the project is correctly configured for the test runner.

**Usage:**

```
php bin/console tmp:tests:verify-setup
```

**Checks performed:**

CheckRequirement`composer.json`File exists and contains valid JSON`tests:warmup` scriptDefined in `composer.json` scripts`phpunit.xml.dist`File exists and contains valid XML`cacheDirectory` attributePresent on `` element (required for `--failed`)Test suitesAll four required suites defined: `unit`, `integration`, `application`, `acceptance`**Warnings (non-blocking):**

- Missing recommended PHPUnit attributes (`executionOrder`, `failOnRisky`, `failOnWarning`, `beStrictAboutOutputDuringTests`)
- ParaTest not installed (required for `--parallel` option)

### ServiceTrait - Simplified Integration Testing

[](#servicetrait---simplified-integration-testing)

The `ServiceTrait` provides convenient service access in integration tests, eliminating boilerplate code when retrieving services from the container.

**Key Benefits:**

- Type-safe service retrieval with PHPStan support
- Clean, readable test code
- Automatic validation of service existence
- Designed for `KernelTestCase` integration

**Usage:**

```
