| Prev | Next |
...
<phpunit>
<testsuite name="My Test Suite">
<directory>/path/to/*Test.php files</directory>
<file>/path/to/MyTest.php</file>
</testsuite>
</phpunit>
<phpunit>
<groups>
<include>
<group>name</group>
</include>
<exclude>
<group>name</group>
</exclude>
</groups>
</phpunit>
上の XML 設定ファイルは、 TextUI テストランナーを以下の引数で起動します。
--group name
--exclude-group name
<phpunit>
<filter>
<blacklist>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
<exclude>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
</exclude>
</blacklist>
<whitelist>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
<exclude>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
</exclude>
</whitelist>
</filter>
</phpunit>
上の XML 設定ファイルは、 次のような PHPUnit_Util_Filter クラスを使用することに対応します。
PHPUnit_Util_Filter::addDirectoryToFilter(
'/path/to/files', '.php'
);
PHPUnit_Util_Filter::addFileToFilter('/path/to/file');
PHPUnit_Util_Filter::removeDirectoryFromFilter(
'/path/to/files', '.php'
);
PHPUnit_Util_Filter::removeFileFromFilter('/path/to/file');
PHPUnit_Util_Filter::addDirectoryToWhitelist(
'/path/to/files', '.php'
);
PHPUnit_Util_Filter::addFileToWhitelist('/path/to/file');
PHPUnit_Util_Filter::removeDirectoryFromWhitelist(
'/path/to/files', '.php'
);
PHPUnit_Util_Filter::removeFileFromWhitelist('/path/to/file');
<phpunit>
<logging>
<log type="coverage-html" target="/tmp/report" charset="UTF-8"
yui="true" highlight="false"
lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-xml" target="/tmp/coverage.xml"/>
<log type="graphviz" target="/tmp/logfile.dot"/>
<log type="json" target="/tmp/logfile.json"/>
<log type="metrics-xml" target="/tmp/metrics.xml"/>
<log type="plain" target="/tmp/logfile.txt"/>
<log type="pmd-xml" target="/tmp/pmd.xml" cpdMinLines="5" cpdMinMatches="70"/>
<log type="tap" target="/tmp/logfile.tap"/>
<log type="test-xml" target="/tmp/logfile.xml" logIncompleteSkipped="false"/>
<log type="testdox-html" target="/tmp/testdox.html"/>
<log type="testdox-text" target="/tmp/testdox.txt"/>
</logging>
</phpunit>
上の XML 設定ファイルは、 TextUI テストランナーを以下の引数で起動します。
--coverage-html /tmp/report
--coverage-xml /tmp/coverage.xml
--log-graphviz /tmp/logfile.dot
--log-json /tmp/logfile.json
--log-metrics /tmp/metrics.xml
> /tmp/logfile.txt
--log-pmd /tmp/pmd.xml
--log-tap /tmp/logfile.tap
--log-xml /tmp/logfile.xml
--testdox-html /tmp/testdox.html
--testdox-text /tmp/testdox.txt
<phpunit>
<logging>
<pmd>
<rule class="PHPUnit_Util_Log_PMD_Rule_Project_CRAP"
threshold="5,30"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Class_DepthOfInheritanceTree"
threshold="6"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Class_EfferentCoupling"
threshold="20"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Class_ExcessiveClassLength"
threshold="1000"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Class_ExcessivePublicCount"
threshold="45"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Class_TooManyFields"
threshold="15"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_CodeCoverage"
threshold="35,70"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_CRAP"
threshold="30"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_CyclomaticComplexity"
threshold="20"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_ExcessiveMethodLength"
threshold="100"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_ExcessiveParameterList"
threshold="10"/>
<rule class="PHPUnit_Util_Log_PMD_Rule_Function_NPathComplexity"
threshold="200"/>
</pmd>
</logging>
</phpunit>
上の <rule> は、 組み込みの PMD ルールの設定に対応します。
| Prev | Next |
Copyright © 2005-2011 Sebastian Bergmann.