PHPackages                             digitickets/phpunit-errorhandler - 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. digitickets/phpunit-errorhandler

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

digitickets/phpunit-errorhandler
================================

A simple trait to add to your PHPUnit test allowing you to track and test PHP errors, warnings and notices

4.1.1(7y ago)165.1k↓45.7%1CPL-1.0PHPPHP &gt;=7

Since Jan 20Pushed 7y ago2 watchersCompare

[ Source](https://github.com/digitickets/phpunit-errorhandler)[ Packagist](https://packagist.org/packages/digitickets/phpunit-errorhandler)[ RSS](/packages/digitickets-phpunit-errorhandler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (10)Used By (1)

[![Travis Build Status](https://camo.githubusercontent.com/0690383ab6220f89cf8f8bbdcaf8ff9dbd24980c3ab9b91a1037108b5d6063fa/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d747261766973)](https://travis-ci.org/digitickets/phpunit-errorhandler)[![Scrutinizer Build Status](https://camo.githubusercontent.com/6503635923ffe1403f6b71c626e7d956a4f1c99dbb34de85e58438cf8b15f4e0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/digitickets/phpunit-errorhandler/)[![Scrutinizer Code Coverage](https://camo.githubusercontent.com/d10624d194bfc373964a628660e570e2dfe1fd22c75a760582154167f10ef594/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/digitickets/phpunit-errorhandler/)[![GitHub issues](https://camo.githubusercontent.com/570b22c518da9c8556113c19e6681ccc79890decddabfe6d0d4f023dde24afd0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://github.com/digitickets/phpunit-errorhandler/issues)

[![PHP Version](https://camo.githubusercontent.com/e5fc90cfae416ae48ac97f679218d965b1b6b80f8686859271c63143c71ab73f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/digitickets/phpunit-errorhandler)[![Stable Version](https://camo.githubusercontent.com/10df78670e5a424ced633f0b039e9a4d7ee6888a0a4ab67ecad744b578ab9d93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4c6174657374)](https://packagist.org/packages/digitickets/phpunit-errorhandler)

[![Total Packagist Downloads](https://camo.githubusercontent.com/c7aa29f4d61a2ad837e77c6ce82a2eb221edde6bd4ce5216777b7f1cbb85c3c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d546f74616c2b646f776e6c6f616473)](https://packagist.org/packages/digitickets/phpunit-errorhandler)[![Monthly Packagist Downloads](https://camo.githubusercontent.com/10f4ac56ae7e94a1e744b29d5e21e5fc56e97531fddbe2883c4ff4f40482e857/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4d6f6e74686c792b646f776e6c6f616473)](https://packagist.org/packages/digitickets/phpunit-errorhandler)[![Daily Packagist Downloads](https://camo.githubusercontent.com/8c1872635e73b7e5443539376657a1b37ae3e9ceb763e1833c549a899c803294/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f646967697469636b6574732f706870756e69742d6572726f7268616e646c65722e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4461696c792b646f776e6c6f616473)](https://packagist.org/packages/digitickets/phpunit-errorhandler)

PHPUnit ErrorHandler
====================

[](#phpunit-errorhandler)

An alternative approach to unit testing PHP errors.

Whilst you can use PHPUnit's built-in behaviour of converting all errors, warnings and notices to exceptions, this package allows you to track all PHP errors, including user generated errors, separately.

The code is supplied as a trait and is based upon [Error Condition Testing with PHPUnit](http://www.sitepoint.com/testing-error-conditions-with-phpunit/)

Here is an example use case:

```
