When writing unit tests, it’s often useful to know the code coverage you’ve achieved to see what proportion of your code you’re exercising. Typically you have to commit your code to version control, so your CI server can pull in your updates and produce coverage reports. This means you sometimes commit incomplete tests, where you might forget to test failure branches (throwing exceptions for example).
PHPUnit command line code coverage summaryposted 2011 // php, testing // 0
PHPUnit with() method argument matchersposted 2011 // code, php, testing // 5
I occasionally need the list of method parameter matchers when setting assertions via mocks using
with(). A completely useless example:
$foo->expects($this->once()) ->method('setter') ->with($this->isType('string'));