-
-
Notifications
You must be signed in to change notification settings - Fork 386
Description
I use vfsstram to set up a virtual file system stucture to run tests, when apply code coverage on these tests, the virtal path 'vfs://..' can not be handled by php-code-coverage. it causes PHP_CodeCoverage_Report_Factory::reducepaths behave strangely, you can test it by feeding array('vfs:://somepath' => 'content', '/tmp/' => 'content') to it, leading to the top directory become ''.
But when I ran the tests with 'phpunit.phar' instead of 'verdor/bin/phpunit' which is installed by composer, it is very interesting that all these 'vfs://...' paths were successfully filtered, so I digged into the code, and it turns out that when run with 'phpunit.phar', code $this->whitelistedFiles[realpath($filename)] = true; from PHP_CodeCoverage_Filter::addFileToBlacklist will add 0 => TRUE for file inside 'phpunit.phar' into the 'blackListedFiles', then in the PHP_CodeCoverage_Filter::isFiltered method will return TURE for all inaccessible files, including the 'vfs://..' files.
So, I suggested It would be better to explicitly add a 0 => TRUE into 'blackListedFiles' with a proper comment, so that no implicit behavior here.
Or, please provide a way to exclude 'vfs://...' type of files.