PHPackages                             boundwize/pyrameter - 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. boundwize/pyrameter

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

boundwize/pyrameter
===================

PHPUnit extension that measures the shape of your test pyramid.

0.5.0(2w ago)65.4k12MITPHPPHP ^8.2CI passing

Since Jun 15Pushed 1w ago1 watchersCompare

[ Source](https://github.com/boundwize/pyrameter)[ Packagist](https://packagist.org/packages/boundwize/pyrameter)[ GitHub Sponsors](https://github.com/samsonasik)[ RSS](/packages/boundwize-pyrameter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (6)Versions (31)Used By (2)

Pyrameter
=========

[](#pyrameter)

 [![Pyrameter](./docs/assets/pyrameter_logo.png)](./docs/assets/pyrameter_logo.png)

 Keep your PHPUnit test suite shaped like a pyramid.

[![Latest Version](https://camo.githubusercontent.com/7ebdcec41b41aaad61407fc7b7511f91697ccbb69a11911703d5f658a693f233/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f626f756e6477697a652f707972616d657465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/boundwize/pyrameter/releases)[![ci build](https://github.com/boundwize/pyrameter/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/boundwize/pyrameter/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/8056d94c0cc273022c23397b9ab954905f451a84a148bbeaa414e5e34a849a90/68747470733a2f2f636f6465636f762e696f2f67682f626f756e6477697a652f707972616d657465722f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/boundwize/pyrameter)[![PHPStan](https://camo.githubusercontent.com/fdcdf50c27377a0f41a7196eeaae8539c4684bfc8a1f9843fdac60fdbc53deab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c2532306d61782d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265266c6162656c3d7068707374616e)](https://github.com/phpstan/phpstan)[![Downloads](https://camo.githubusercontent.com/650d08b586ae760c79fdb88deaba7d46d069cd6cc7a7db1af801029fc105cee4/68747470733a2f2f706f7365722e707567782e6f72672f626f756e6477697a652f707972616d657465722f646f776e6c6f616473)](https://packagist.org/packages/boundwize/pyrameter)

[![Windows](https://camo.githubusercontent.com/40d55ea84a66155f7e5a3ca552f53374c32693147bb1def55b3522fe5f4964c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f57696e646f77732d737570706f727465642d3030373844363f6c6f676f3d77696e646f7773266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)](https://camo.githubusercontent.com/40d55ea84a66155f7e5a3ca552f53374c32693147bb1def55b3522fe5f4964c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f57696e646f77732d737570706f727465642d3030373844363f6c6f676f3d77696e646f7773266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)[![macOS](https://camo.githubusercontent.com/87062865228d41f8646f09e2f5836456aaecf50f98a01a95ed649d9e9046e226/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61634f532d737570706f727465642d4330383446433f6c6f676f3d6170706c65266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)](https://camo.githubusercontent.com/87062865228d41f8646f09e2f5836456aaecf50f98a01a95ed649d9e9046e226/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61634f532d737570706f727465642d4330383446433f6c6f676f3d6170706c65266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)[![Linux](https://camo.githubusercontent.com/ecaba20632a2d08464c0ce7f3f974a13a937dd5acf6f9d0d1065325b78475899/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e75782d737570706f727465642d4643433632343f6c6f676f3d6c696e7578266c6f676f436f6c6f723d626c61636b266c6162656c436f6c6f723d353535353535)](https://camo.githubusercontent.com/ecaba20632a2d08464c0ce7f3f974a13a937dd5acf6f9d0d1065325b78475899/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e75782d737570706f727465642d4643433632343f6c6f676f3d6c696e7578266c6f676f436f6c6f723d626c61636b266c6162656c436f6c6f723d353535353535)

```
vendor/bin/phpunit
........................
=========
Pyrameter
=========

Shape:  Integration Mountain
Result: Violated ⚠

               ▲  E2E             ✓
             ▄▄▄▄▄  Integration   ✗
           ▄▄▄▄▄▄▄▄▄  Functional  ✓
         ▄▄▄▄▄▄▄▄▄▄▄▄▄  Unit      ✗

+=============+=======+========+============+
|    KIND     | TESTS | ACTUAL |   TARGET   |
+=============+=======+========+============+
| Unit        |    39 |  65.0% | >= 70.0% ✗ |
+-------------+-------+--------+------------+
| Functional  |    10 |  16.7% | usesClass(App\Search\ExternalSearch::class, TestKind::Integration);
```

Define the complete configuration yourself:

```
return PyrameterConfig::create()
    ->usesClass(PDO::class, TestKind::Integration)
    ->targetShape(
        unit: ['min' => 80],
        integration: ['max' => 20],
    );
```

A complete `pyrameter.php` can combine rules, targets, and CI behavior:

```
