phpunitHow to run only certain methods in PHPUnit?
You can run only certain methods in PHPUnit by using the --filter
option.
For example, to run only the testAdd()
method in the CalculatorTest
class, you can use the following command:
phpunit --filter testAdd CalculatorTest
This will run only the testAdd()
method in the CalculatorTest
class.
The parts of the command are:
phpunit
: the command to run PHPUnit--filter
: the option to specify which method to runtestAdd
: the name of the method to runCalculatorTest
: the name of the class containing the method
For more information, see 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...