문제

I would like to know if it's possible to generate a code coverage from one single file. Let's say I am writing tests for a class BankAccount, it would be handy if i could from command line do something like

phpunit BankAccount.php --create-coverage-for-this-file-only

Does anyone have experience experience with this?

Thaks

올바른 솔루션이 없습니다

다른 팁

Using the XML file, you can include the files or directories you want to process, and exclude the ones you do not. PHPUnit Manual Entry

<filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
        <file>BankAccount.php</file>
        <directory suffix=".class">.</directory>
        <directory suffix=".fn">.</directory>
        <directory suffix=".php">.</directory>
        <exclude>
            <directory>ExternalLibraries</directory>
        </exclude>
    </whitelist>
</filter>

Yes you can do this with the --filter option.

phpunit -d xdebug.profiler_enable=On --coverage-html tests/_report/ --filter=BankAccount
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top