Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 870 Bytes

how-to-run-only-certain-methods-in-phpunit.md

File metadata and controls

23 lines (16 loc) · 870 Bytes

How to run only certain methods in PHPUnit?

// 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 run
  • testAdd: the name of the method to run
  • CalculatorTest: the name of the class containing the method

For more information, see the PHPUnit documentation.

onelinerhub: How to run only certain methods in PHPUnit?