9951 explained code solutions for 126 technologies


phpunitHow to use filters with PHPUnit?


Filters can be used with PHPUnit to limit the tests that are run. This is useful when you want to focus on a specific set of tests.

Example

$ phpunit --filter testName

This will run only the tests that match the given name.

Code explanation

  1. phpunit - This is the command used to run the tests.
  2. --filter - This is the flag used to specify the filter.
  3. testName - This is the name of the test to be run.

Helpful links

Edit this code on GitHub