Download the PHP package howtomakeaturn/easy-coverage without Composer
On this page you can find all versions of the php package howtomakeaturn/easy-coverage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download howtomakeaturn/easy-coverage
More information about howtomakeaturn/easy-coverage
Files in howtomakeaturn/easy-coverage
Package easy-coverage
Short Description A simple package to encourage/force developers to write tests.
License MIT
Informations about the package easy-coverage
Introduction
A simple package to encourage/force developers to write tests.
Why I built this package?
I'm working with multiple junior developers in multiple projects.
I always want to find a way to encourage/force them to write tests.
And I want this process to be integrated into the CI/CD and pre-push workflow.
Installation
Usage
Let's say you think App\Services
namespace is very important, and you want to force all developers to write tests for every public method under this namespace.
Here is the basic example:
Anytime you create a new test for the related methods, use PHP 8 Attribute Syntax
to label them:
And that's it!
Anyone who creates new public methods in any classes under App\Services
have to write tests!
If you want to ignore some methods, you can use
If you want to ignore some classes, you can use
If you want to ignore certain methods in classes, you can use
Recommended workflow
-
You specify multiple namespaces that you think writing tests are necessary.
-
Run EasyCoverage in PHPUnit & CI/CD & pre-push workflow.
- Anyone who writes new public methods under these namespaces will be forced to write tests!
How does this work behind the scenes?
-
EasyCoverage finds out all the
public
&non-static
methods under the namesapces you specify. -
EasyCoverage finds out all the class methods you labeled with
Howtomakeaturn\EasyCoverage\Target
attribute under theTests
namespace. - EasyCoverage compares two array values from above and then return the result.
License
The EasyCoverage is open-sourced software licensed under the MIT license.