phpunit xml配置例子

phpstorm里配置比较方便,可以算是已经集成了
mac版本有点怪,xdebug配置好就无法使用phpunit ,windows版本正常

phpunit如果想测试目录所有php文件的话,需要增加个xml配置:比如叫phpunit.xml

 <phpunit backupGlobals="true"
         bootstrap="tests/bootstrap.php"
         backupStaticAttributes="false"
         cacheTokens="false"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
         strict="false"
         verbose="true">
    <testsuites>
        <testsuite name="foo Tests">
            <directory>./</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-clover" target="./clover.xml"/>
    </logging>
</phpunit>