定制 ockcyp/covers-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ockcyp/covers-validator

Composer 安装命令:

composer require --dev ockcyp/covers-validator

包简介

Validates @covers tags in PHPUnit tests

README 文档

README

CI Coverage Status Scrutinizer Code Quality License Total Downloads

PHPUnit @covers tags validator

Why?

PHPUnit fails to generate a coverage report when tests have invalid @covers tags.

This tool allows you to determine the tests that have invalid @covers tags without you needing to run the coverage.

Usually coverage reports are run less often than the tests as they take a long time to run. This tool validates your @covers tags quicker than you run your tests.

Trying to @cover or @use not existing class or interface "NonExistentClass".
Trying to @cover or @use not existing method "ExistingClass::nonExistantMethod".

See: phpunit/issues/1758
Also see: phpunit/issues/1791

Abandoned alternative: dunkelfrosch/phpcoverfish

Getting Started

Prerequisites

  • PHP 7.1+
  • PHPUnit 7.0+

Installation

Composer

Recommended way of installing covers-validator is via Composer.

composer require --dev ockcyp/covers-validator

Phar

Download the covers-validator.phar asset from the latest release or any other release from the releases.

Then run using the following:

php covers-validator.phar

Note

The usage documentation assumes you installed covers-validator using Composer, so please replace any reference to "vendor/bin/covers-validator" with "php covers-validator.phar".

Note

Only releases since v0.3.0 can be used as a phar.

Older versions

Latest release of covers-validator supports PHP 7.1+ and PHPUnit 7+. Please use a previous release with older PHP and PHPUnit versions.

PHPUnit version Covers-validator release
< 6.0 0.5.x
6.0 - 9.x 1.5
7.0 - 9.x 1.6
7.0 - 10.x >= 1.7.0

Usage

Run the validator using the following:

vendor/bin/covers-validator

Tip

The command returns exit code 1 when any of the covers tags are invalid. Use this to fail your builds.

Override configuration file

Give optional -c argument to load a particular PHPUnit configuration file:

vendor/bin/covers-validator -c tests/Fixtures/configuration.xml

Override PHPUnit bootstrap

Override the bootstrap value specified in PHPUnit configuration:

vendor/bin/covers-validator --bootstrap tests/bootstrap.php

Disable output

Disable output by providing the -q argument

vendor/bin/covers-validator -q

Adjust the verbosity:

Verbosity Shows
-v Valid tests
-vv Loaded configuration file
-vvv Test name before validation is done

Sample output

Normal verbosity

Invalid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest

There were 1 test(s) with invalid @covers tags.

Maximum verbosity (debug)

Configuration file loaded: /home/omer/Projects/Personal/covers-validator/tests/Fixtures/configuration-all.xml

Validating OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringExistingClassTest::testDummyTest...
Valid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringExistingClassTest::testDummyTest
Validating OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest...
Invalid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest

There were 1 test(s) with invalid @covers tags.

Tests

To run the tests, execute:

vendor/bin/phpunit

Versioning

We use Semantic Versioning for versioning. For the versions available, see the releases or the CHANGELOG.md file.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Acknowledgments

ockcyp/covers-validator 适用场景与选型建议

ockcyp/covers-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 208.77k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2015 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「testing」 「phpunit」 「coverage」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ockcyp/covers-validator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ockcyp/covers-validator 我们能提供哪些服务?
定制开发 / 二次开发

基于 ockcyp/covers-validator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 208.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 6
  • 依赖项目数: 94
  • 推荐数: 0

GitHub 信息

  • Stars: 21
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-25