Misleading Code Coverage Reports for Switch Statements

I was recently investigating the code coverage of the map_meta_cap() function in WordPress’ core unit test suite — particularly the large switch statement contained within the function. I was surprised to see that the coverage was higher than I was expecting, because I know for a fact that several meta capabilities aren’t tested. It turns out …