PHPackages                             trinet/mezzio-test - 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. trinet/mezzio-test

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

trinet/mezzio-test
==================

Testing helpers for mezzio projects

1.3.0(4d ago)6992↓37.5%11MITPHPPHP ^8.2CI failing

Since Jan 17Pushed 4d ago2 watchersCompare

[ Source](https://github.com/trinet-at/mezzio-test)[ Packagist](https://packagist.org/packages/trinet/mezzio-test)[ RSS](/packages/trinet-mezzio-test/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (42)Versions (16)Used By (1)

[![Check Build](https://github.com/trinet-at/mezzio-test/workflows/Check%20Build/badge.svg)](https://github.com/trinet-at/mezzio-test/workflows/Check%20Build/badge.svg)

mezzio-test
===========

[](#mezzio-test)

`mezzio-test` provides classes and tools to help testing [mezzio](https://github.com/mezzio/mezzio) applications. Its API aims to be similar to [`laminas-test`](https://github.com/laminas/laminas-test) to ease migration from Laminas MVC to Mezzio.

The package is not bound to any testing framework as it does not do any assertions. Instead it just bootstraps the `Container` and `Application` based on your config file. Config file locations default to the [mezzio-skeleton](https://github.com/mezzio/mezzio-skeleton), but can be reconfigured.

Also, a `TestConfigProvider` is provided for loading custom testing configuration (custom database, custom container configuration, ...).

Usage
-----

[](#usage)

Instantiate the `\Trinet\MezzioTest\MezzioTestEnvironment` class in your test setup:

```
protected function setUp(): void
{
    parent::setUp();
    $this->mezzioApp = new MezzioTestEnvironment();
}
```

This will build your application container, bootstrap the mezzio Application (pipeline, routes) and registers a custom `\Laminas\Stratigility\Middleware\ErrorHandler` listener, which will just re-throw any exception. Thus, the native exception assertions can be used (eg. `$this->expectException()` in PHPUnit).

Currently, the Test environment offers three possibilities to dispatch a request:

- `dispatch(UriInterface|string $uri, ?string $method = null, array $params = [], array $headers = []): ResponseInterface`: dispatch any URI with the given method (defaults to `GET`). `$params` will be used as query parameters for `GET`and as parsed body for `POST` requests.
- `dispatchRoute(string $routeName, array $routeParams = [], string $method = null, array $requestParams = [], array $headers = []): ResponseInterface`: dispatch a given named route
- `dispatchRequest(ServerRequestInterface $request): ResponseInterface`: dispatch a `ServerRequestInterface`

If your base directory is not at the default location, a constructor parameter can be given to `MezzioTestEnvironment`.

The container and router can also be retrieved with `MezzioTestEnvironment->container()` and `->router()`, respectively.

### Configuration

[](#configuration)

The `\Trinet\MezzioTest\TestConfigProvider` can be used to load additional config files used for testing. It will look for `*testing.php`, `*testing.local.php`, `testing/*testing.php` and `testing/*testing.local.php`in the config directory, which defaults to `config/autoload/` in your project root, but can be configured to anything else.

To use it, call the loader when in testing mode in your `config/config.php` file to get an array of providers:

```
$providers = [
    \A\ConfigProvider::class,
    \B\ConfigProvider::class,
    // ...
];

if (getenv('APP_TESTING') !== false) {
    $providers = array_merge($providers, \Trinet\MezzioTest\TestConfigProvider::load());
}

$aggregator = new ConfigAggregator($providers, null, []);
```

or to use another config path:

```
$providers = [
    \A\ConfigProvider::class,
    \B\ConfigProvider::class,
    // ...
];

if (getenv('APP_TESTING') !== false) {
    $providers = array_merge($providers, \Trinet\MezzioTest\TestConfigProvider::load('custom/path'));
}

$aggregator = new ConfigAggregator($providers, null, []);
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance99

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~209 days

Recently: every ~420 days

Total

12

Last Release

4d ago

Major Versions

0.3.1 → 1.0.02021-06-25

PHP version history (5 changes)0.1.0PHP ^7.2

0.3.0PHP ^7.3

0.3.1PHP ^7.3 || ^8.0

1.0.0PHP ^7.4 || ^8.0

1.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/bf84c6852b03fde91d73c1c04b6dabe5d47167d4994a6cf40c11e5cfd18d07e7?d=identicon)[trinet](/maintainers/trinet)

---

Top Contributors

[![rieschl](https://avatars.githubusercontent.com/u/3321556?v=4)](https://github.com/rieschl "rieschl (18 commits)")[![wshafer](https://avatars.githubusercontent.com/u/1828455?v=4)](https://github.com/wshafer "wshafer (2 commits)")

---

Tags

assertionshacktoberfestmezziomezzio-testphptesting

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/trinet-mezzio-test/health.svg)

```
[![Health](https://phpackages.com/badges/trinet-mezzio-test/health.svg)](https://phpackages.com/packages/trinet-mezzio-test)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M774](/packages/typo3-testing-framework)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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