The --filter option for phpunit does a fuzzy match. Let's say I have a test called testHandle and another test called testHandleFooBar. How can I run only testHandle using the --filter option?
The --filter option for phpunit does a fuzzy match. Let's say I have a test called testHandle and another test called testHandleFooBar. How can I run only testHandle using the --filter option?
Per the docs:
--filterOnly runs tests whose name matches the given regular expression pattern. If the pattern is not enclosed in delimiters, PHPUnit will enclose the pattern in / delimiters.
The basic format for a test method filter is the following:
TestNamespace\TestCaseClass::testMethod
So, by doing:
--filter '/::testHandle$/'
It will match only a method whose name is exactly testHandle, since the $ character matches the end of a string in a regular expression.