jimmyoak / phpunit-test-checker
Installs: 2 499
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.3
- jimmyoak/utilities: 2.5.1b
- symfony/console: ^2.6
Requires (Dev)
- phpunit/phpunit: ^4.8
README
Description
Check for classes without tests. Intended for pre-commit hook.
Usage
Config file example (phpunit-test-checker.json):
{ "suites": [ { "src-path": "src/", "test-path": "test/", "test-case-suffix": "Test" } ] }
Read config and check for classes with no tests:
use JimmyOak\PhpUnitChecker\Checker\Checker; require_once __DIR__ . '/vendor/autoload.php'; $checker = new Checker(\JimmyOak\PhpUnitChecker\Config\JsonConfigReader::readFile(__DIR__ . '/phpunit-test-checker.json')); $checker->check();
Output:
Classes with no tests:
- Checker/Checker.php
- Command/CheckerCommand.php
But if we run with this config...:
{ "suites": [ { "src-path": "src/", "test-path": "test/", "test-case-suffix": "Test", "excluded": [ "Checker/Checker.php", "Command/" ] } ] }
Outputs nothing :)
"Excluded" is just a regex like /^Command/, therefore if it's a folder put the / separator at the end.
TODO
A lot of improvements. This is only an approach. (Proof of concept)