esi/phpunit-coverage-check
Reads PHPUnit clover/openclover XML coverage reports and computes overall coverage percentage. Fails CI with exit code 1 when coverage drops below a configurable threshold; exits successfully when the threshold is met. Useful for enforcing minimum test coverage.
composer.json script psalm:ci now uses the psalm script instead of the (now removed) psalm:security.Command\CoverageCheckCommand to use __invoke() instead of configure() and execute(). This was introduced in Symfony 7.3.
Symfony\Component\Console\Command\Command for now.README.md for some minor enhancements, and to add information for the new --table-width option.processByFile() to handle the new experimental support for OpenClover in PHPUnit 12.2+Symfony\Component\Console\Application::add(). Will use Symfony\Component\Console\Application::addCommand() instead if on
symfony/console version >=7.4.
psalm.xml (Psalm's configuration) to move tests to extraFiles and suppress possible unused methods/classes for now.composer.json script psalm:security has been removed.Full Changelog: https://github.com/ericsizemore/phpunit-coverage-check/compare/3.0.0...3.1.0
This release is mainly a bump to a PHP 8.3 requirement with some minor refactoring.
Esi\CoverageCheck\CoverageCheck and Esi\CoverageCheck\Command\CoverageCheckCommand for ERROR and OK messages, so they are easier to update (if needed) in the future.
CoverageCheckCommand do not use the '[ERROR]' and '[OK]' prefixes as the symfony/console method(s) used to output these messages add the prefixes automatically.CoverageCheckCommand also remove the extra '%' in the format as it is added in with the formatted coverage.Exceptions\FailedToGetFileContentsExceptionExceptions\InvalidInputFileExceptionExceptions\NotAValidCloverFileExceptionExceptions\ThresholdOutOfBoundsExceptionfinal, and the Utils class made abstract since it is never instantiated (all static methods).coverage-check file moved to bin/coverage-check^12.0-dev until official release).phpstan-baseline.neon as it doesn't seem to understand xpath()'s ability to possibly return null or false.continuous-integration.yml.Full Changelog: https://github.com/ericsizemore/phpunit-coverage-check/compare/2.0.2...3.0.0
phpstan-baseline.neon for PHPStan..asc for verificationphpstan/extension-installer with composer.json config updated to allow plugins for PHPStan.backward-compatibility.mdCONTRIBUTING.md with more guidelines/information..gitattributesphpstan to the non-dev 1.12.0phpstan/phpstan-phpunit to the non-dev 1.4.0phpstan/phpstan-strict-rules to the non-dev 1.6.0box configuration for generating the Phar has been updated.
Esi\CoverageCheckPhar.ext-zlib as a requirement to run it.Esi\CoverageCheck\Application class which extends Symfony\Component\Console\Application.
getDefaultInputDefinition() and configureIO() to clean up help output.Utils class.
isPossiblyClover(), which attempts to ensure the provided file is a PHPUnit generated clover file.Style\CoverageCheckStyle which extends Symfony\Console\Style\SymfonyStyle to format console output.--only-percentage option for the Console. You can use -O instead.--show-files (shortcut -F), to break down metrics by file, and output the results via a table.
CoverageCheck::XPATH_FILES and the following functions:
CoverageCheck::processByFile()CoverageCheckCommand::getFileTable()CoverageCheckCommand::getResultOutput()coverage:check when calling the Phar or the bin file is no longer needed.# before
$ php vendor/bin/coverage-check coverage:check /path/to/clover.xml 90
# after
$ php vendor/bin/coverage-check /path/to/clover.xml 90
CoverageCheck::loadMetrics can now throw a RuntimeException if file_get_contents fails for whatever reason or if the new isPossiblyClover returns false.
--show-files option and related additions, the CoverageCheck::loadMetrics() now has one parameter: $xpath.XPATH_METRICS now has protected visibility.APPLICATION_NAME and VERSION moved from CoverageCheck to Application.
Application now also overrides the parent Symfony\Component\Console\Application constructor and passes these values to the parent class.CoverageCheck::nonConsoleCall and the Console to match more closely:
CoverageCheckCommand updated to use the Symfony\Console\Attribute\AsCommand attribute, as using the static properties is deprecated as of Symfony\Console 6.1.phpstan\phpstan-symfony. Seemed to be a bit overkill to require a dependency for something I was able to solve with a couple extra lines, and was running into an issue where it seemed to suppress other issues from being reported.tests/console-application.php, since it was a requirement for phpstan-symfony.--show-files option is not yet supported in CoverageCheck::nonConsoleCall().Full Changelog: https://github.com/ericsizemore/phpunit-coverage-check/compare/1.0.0...2.0.0
This intial version is forked from rregeer/phpunit-coverage-check by Richard Regeer. This is the CHANGELOG for changes in comparison to the original library.
backward-compatibility.md for the Backward Compatibility Promise.CHANGELOG.md to keep track of changes.SECURITY.md for the security policy.box.json that is used for generating Phar files for the library.
Symfony\Console is now a runtime dependency.Esi\CoverageCheck.coverage-check (instead of coverage-check.php) in the root directory, which is the bin file.README.md with more information, and changes to the usage of this library.Symfony\Console application.coverage-check.php, bin/coverage-check, and test/run removed.How can I help you explore Laravel packages today?