| Prev | Next |
The attributes of the <phpunit> element can be used to configure PHPUnit's core functionality.
<phpunit bootstrap="/path/to/bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="true">
<!-- ... -->
</phpunit>
The XML configuration above corresponds to invoking the TextUI test runner with the following switches:
--bootstrap /path/to/bootstrap.php
--colors
--stop-on-failure
The convertErrorsToExceptions, convertNoticesToExceptions, and convertWarningsToExceptions attributes have no equivalent TextUI test runner switch.
The <testsuite> element can be used to compose a test suite out of test suites and test cases.
<testsuite name="My Test Suite"> <directory>/path/to/*Test.php files</directory> <file>/path/to/MyTest.php</file> </testsuite>
The <groups> element and its <include>, <exclude>, and <group> children can be used to select groups of tests from a suite of tests that should (not) be run.
<groups>
<include>
<group>name</group>
</include>
<exclude>
<group>name</group>
</exclude>
</groups>
The XML configuration above corresponds to invoking the TextUI test runner with the following switches:
--group name
--exclude-group name
The <filter> element and its children can be used to configure the blacklist and whitelist for the code coverage reporting.
<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>
The XML configuration above corresponds to using the PHPUnit_Util_Filter class as follows:
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');
The <logging> element and its <log> children can be used to configure the logging of the test execution.
<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="json" target="/tmp/logfile.json"/>
<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>
The XML configuration above corresponds to invoking the TextUI test runner with the following switches:
--coverage-html /tmp/report
--coverage-xml /tmp/coverage.xml
--log-json /tmp/logfile.json
> /tmp/logfile.txt
--log-tap /tmp/logfile.tap
--log-xml /tmp/logfile.xml
--testdox-html /tmp/testdox.html
--testdox-text /tmp/testdox.txt
The charset, yui, highlight, lowUpperBound, highLowerBound, and logIncompleteSkipped attributes have no equivalent TextUI test runner switch.
The <php> element and its children can be used to configure PHP settings and global variables.
<php> <ini name="foo" value="bar"/> <var name="foo" value="bar"/> </php>
The XML configuration above corresponds to the following PHP code:
ini_set('foo', 'bar');
$GLOBALS['foo'] = 'bar';
The <selenium> element and its <browser> children can be used to configure a list of Selenium RC servers.
<selenium>
<browser name="Firefox on Linux"
browser="*firefox /usr/lib/firefox/firefox-bin"
host="my.linux.box"
port="4444"
timeout="30000"/>
</selenium>
The XML configuration above corresponds to the following PHP code:
class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
public static $browsers = array(
array(
'name' => 'Firefox on Linux',
'browser' => '*firefox /usr/lib/firefox/firefox-bin',
'host' => 'my.linux.box',
'port' => 4444,
'timeout' => 30000
)
);
// ...
}
| Prev | Next |
assertArrayHasKey()
assertClassHasAttribute()
assertClassHasStaticAttribute()
assertContains()
assertContainsOnly()
assertEqualXMLStructure()
assertEquals()
assertFalse()
assertFileEquals()
assertFileExists()
assertGreaterThan()
assertGreaterThanOrEqual()
assertLessThan()
assertLessThanOrEqual()
assertNotNull()
assertObjectHasAttribute()
assertRegExp()
assertSame()
assertSelectCount()
assertSelectEquals()
assertSelectRegExp()
assertStringEqualsFile()
assertTag()
assertThat()
assertTrue()
assertType()
assertXmlFileEqualsXmlFile()
assertXmlStringEqualsXmlFile()
assertXmlStringEqualsXmlString()
Copyright © 2005-2011 Sebastian Bergmann.