質問

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