PHP 代码覆盖率工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/348850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:28:13  来源:igfitidea点击:

Code Coverage tools for PHP

phpcode-coverage

提问by gagneet

Is there any code coverage tool available for PHP? I wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature.

是否有任何可用于 PHP 的代码覆盖工具?我希望检查我的代码和用 PHP 编写的 API 的代码覆盖率,但我无法使用任何用于 PHP 的代码覆盖率工具,因为它更像是一种服务器端语言并且本质上是动态的。

Does anyone know of a method by which code coverage for PHP can be executed?

有谁知道可以执行 PHP 代码覆盖率的方法吗?

采纳答案by CMS

xdebughas Code Coverage Analysis.

xdebug代码覆盖率分析

Check this chapterof the PHPUnit Manual

检查PHPUnit手册的这一章

回答by Ira Baxter

See our PHP Test Coverage tool from Semantic Designs:

请参阅 Semantic Designs 的 PHP 测试覆盖率工具:

http://www.semanticdesigns.com/Products/TestCoverage/PHPTestCoverage.html

http://www.semanticdesigns.com/Products/TestCoverage/PHPTestCoverage.html

Very low overhead, handles huge systems of files, intuitive GUI showing coverage on specific files, and generated report with coverage breakdown at method, class and package levels.

非常低的开销,处理庞大的文件系统,直观的 GUI 显示特定文件的覆盖率,以及生成的报告,包括方法、类和包级别的覆盖率细分。

Best of all, no requirement to install anythingin the system being tested. No need for xdebug, etc., which means you don't have to argue with the sysadmin to do your testing.

最重要的是,不需要在被测试的系统中安装任何东西。不需要 xdebug 等,这意味着您不必与系统管理员争论来进行测试。

You can use it with PHPUnit to get unit-test driven coverage. Or you can use it on your website to collect coverage from any functional testing approach/tools you may have.

您可以将它与 PHPUnit 一起使用以获得单元测试驱动的覆盖率。或者您可以在您的网站上使用它来收集您可能拥有的任何功能测试方法/工具的覆盖范围。

回答by Brian Fisher

Using Xdebug in combination with PHPUnitcan give you code coverage analysis.

将 Xdebug 与PHPUnit结合使用可以为您提供代码覆盖率分析。

回答by troelskn

Spike PHPCoverage. Both SimpleTestand PHPUnitcan easily be integrated with it, although PHPUnits support is there out-of-the-box.

秒杀 PHPCoverage。无论SimpleTest的PHPUnit的可以很容易地整合它,虽然PHPUnits的支持是有外的开箱。

回答by Will

Xdebug can do code coverage reporting, and Phing, a build utility, can automate running coverage reports (http://devzone.zend.com/article/2955).

Xdebug 可以做代码覆盖率报告,Phing 是一个构建工具,可以自动运行覆盖率报告 ( http://devzone.zend.com/article/2955)。

回答by cparrish817

Zend Studio ships with code coverage tools out the box.

Zend Studio 附带了开箱即用的代码覆盖工具。