phpunitHow to configure PHPUnit?
PHPUnit is a unit testing framework for the PHP programming language. It can be configured in several ways:
- Configuration File: A configuration file can be used to set up the environment for PHPUnit. The configuration file should be named
phpunit.xml
and placed in the root directory of the project. The following example shows a basic configuration file:
<phpunit>
<testsuites>
<testsuite name="My Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
- Command Line Options: PHPUnit can also be configured using command line options. For example, the following command will run all tests in the
tests
directory:
phpunit --bootstrap ./tests/bootstrap.php ./tests
- Environment Variables: PHPUnit can also be configured using environment variables. For example, the following environment variable will set the default bootstrap file:
PHPUNIT_BOOTSTRAP=./tests/bootstrap.php
For more information, please refer to the PHPUnit Documentation.
More of Phpunit
- How to skip a PHPUnit test?
- How to run tests in parallel with PHPUnit?
- How to use hooks in PHPUnit?
- What are PHPUnit required extensions
- How to use the PHPUnit Framework TestCase?
- How to run PHPUnit in quiet mode?
- How to show warnings in PHPUnit?
- How to load fixtures with PHPUnit?
- How to use a listener with PHPUnit?
- How to stop PHPUnit on failure?
See more codes...