PHPackages                             vgirol/phpunit-exception - 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. vgirol/phpunit-exception

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

vgirol/phpunit-exception
========================

Add some utilities to test exceptions when using PHPUnit

v2.1.2(5y ago)05144MITPHPPHP ^7.3|^8.0

Since Apr 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/VGirol/Phpunit-Exception)[ Packagist](https://packagist.org/packages/vgirol/phpunit-exception)[ Docs](https://github.com/VGirol/Phpunit-Exception)[ RSS](/packages/vgirol-phpunit-exception/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (2)Versions (11)Used By (4)

Phpunit-Exception
=================

[](#phpunit-exception)

[![Latest Version on Packagist](https://camo.githubusercontent.com/86310f02782efcf2d2e29838342adaeb635f92cc12f15eadb53574040bdd63ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f564769726f6c2f506870756e69742d457863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/VGirol/Phpunit-Exception)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/fdc1505877ae13b47752d73cff2548215fdcffb249ef30fd06e38de6ab7ee934/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f564769726f6c2f506870756e69742d457863657074696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/VGirol/Phpunit-Exception)[![Coverage Status](https://camo.githubusercontent.com/52d0ccf15ec6d42127fa11ce78f6544ad9fdacc85ed81d39a0602e2f0d23a97f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f564769726f6c2f506870756e69742d457863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/VGirol/Phpunit-Exception/code-structure)[![Quality Score](https://camo.githubusercontent.com/f25b2108fb9893290f87df35e3def3335c44653f920ffce1c7894cb0f848b0ff/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f564769726f6c2f506870756e69742d457863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/VGirol/Phpunit-Exception)[![Infection MSI](https://camo.githubusercontent.com/10a4b85f6843819bfd0ce3f38ab729a5a180335a67a6d529900d9bdf801efe4a/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246564769726f6c253246506870756e69742d457863657074696f6e2532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/VGirol/Phpunit-Exception/master)[![Total Downloads](https://camo.githubusercontent.com/2c12997fa6b5271da610eb6a7269f2bab38417ca9b53060bc34ece2d35cf2116/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f564769726f6c2f506870756e69742d457863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/VGirol/Phpunit-Exception)

Technologies
------------

[](#technologies)

- PHP 7.3+
- PHPUnit 9+

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

[](#installation)

To install through composer, simply put the following in your `composer.json` file:

```
{
    "require-dev": {
        "vgirol/phpunit-exception": "dev-master"
    }
}
```

And then run `composer install` from the terminal.

### Quick Installation

[](#quick-installation)

Above installation can also be simplified by using the following command:

```
$ composer require vgirol/phpunit-exception
```

Usage
-----

[](#usage)

```
use PHPUnit\Framework\TestCase as BaseTestCase;
use VGirol\PhpunitException\SetExceptionsTrait;

class TestCase extends BaseTestCase
{
    use SetExceptionsTrait;

    public function test()
    {
        $className = \Exception::class;
        $message = 'Error';
        $code = 666;

        $this->setFailure($className, $message, $code);

        throw new \Exception($message, $code);
    }
}
```

Documentation
-------------

[](#documentation)

The API documentation is available in XHTML format at the url .

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Girol Vincent](https://github.com/VGirol)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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

Every ~40 days

Recently: every ~0 days

Total

10

Last Release

1869d ago

Major Versions

v1.0.0 → v2.0.02020-04-09

v1.0.1 → v2.0.22021-04-02

PHP version history (4 changes)v1.0.0PHP ^7.2

v2.0.0PHP ^7.3|^7.4

v2.0.1PHP ^7.3

v2.0.3PHP ^7.3|^8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

vgirolPhpunit-Exception

### Embed Badge

![Health badge](/badges/vgirol-phpunit-exception/health.svg)

```
[![Health](https://phpackages.com/badges/vgirol-phpunit-exception/health.svg)](https://phpackages.com/packages/vgirol-phpunit-exception)
```

###  Alternatives

[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

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

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

31252.7k5](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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