vgirol / phpunit-exception
Add some utilities to test exceptions when using PHPUnit
Installs: 514
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/vgirol/phpunit-exception
Requires
- php: ^7.3|^8.0
- phpunit/phpunit: ^9.0
Requires (Dev)
- infection/infection: ~0.14
README
Technologies
- PHP 7.3+
- PHPUnit 9+
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
Above installation can also be simplified by using the following command:
$ composer require vgirol/phpunit-exception
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
The API documentation is available in XHTML format at the url http://Phpunit-Exception.girol.fr/docs/ref/index.html.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email vincent@girol.fr instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.