php – 仅生成刚刚测试过的内容

前端之家收集整理的这篇文章主要介绍了php – 仅生成刚刚测试过的内容前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
每次我运行一个类或整个文件夹的单元测试时,PHPunit会为整个系统生成覆盖,因为它是在PHPunit.xml中配置的.
这很糟糕,因为它需要更长的时间并耗尽 PHP的内存.

我的PHPunit.xml

<!-- http://www.PHPunit.de/manual/current/en/appendixes.configuration.html -->
<PHPunit
    backupGlobals               = "false"
    backupStaticAttributes      = "false"
    colors                      = "true"
    convertErrorsToExceptions   = "true"
    convertNoticesToExceptions  = "true"
    convertWarningsToExceptions = "true"
    processIsolation            = "false"
    stopOnFailure               = "false"
    SyntaxCheck                 = "false"
    bootstrap                   = "Bootstrap.PHP" >

    <testsuites>
        <testsuite name="Application Module Suite Test">
            <directory>./Module1Test</directory>
            <directory>./Module2Test</directory>
            <directory>./Module3Test</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>../module/Module1</directory>
            <directory>../module/Module2</directory>
            <directory>../module/Module3</directory>
        </whitelist>
    </filter>

</PHPunit>

有没有办法动态地生成我现在正在测试的内容


对于下面的命令,我想仅为Controller / ExampleController.PHP路径生成覆盖.

PHPunit Controller/ExampleController.PHP --coverage-html ~/Desktop/tests

我正在使用PHPUnit 4.8和3.7,Sublime Text Editor,应用程序正在使用Zend Framework 2.

PHPUnit 5.6手册:

The @covers annotation (see Table B.1) can be used in the test code to specify which method(s) a test method wants to test. If provided,only the code coverage information for the specified method(s) will be considered. Example 11.2 shows an example.

请参阅此链接获取示例:https://phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.specifying-covered-methods.examples.BankAccountTest.php

这对你的场景有用吗?

原文链接:https://www.f2er.com/php/136890.html

猜你在找的PHP相关文章