// plain
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.
onelinerhub: How to run only certain methods in PHPUnit?