[wp-trac] [WordPress Trac] #43067: Code coverage cannot be run

WordPress Trac noreply at wordpress.org
Thu Jan 11 14:27:51 UTC 2018


#43067: Code coverage cannot be run
------------------------------+-----------------------------
 Reporter:  jipmoors          |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 The current PHPUnit configuration has been configured as follows:
 {{{
 <filter>
     <whitelist processUncoveredFilesFromWhitelist="true">
         <directory suffix=".php">src</directory>
     </whitelist>
 </filter>
 }}}

 This means that all the files in the `src/` folder are included when
 running a coverage report.

 Reference to documentation:
 https://phpunit.de/manual/current/en/code-coverage-analysis.html#code-
 coverage-analysis.whitelisting-files

 > Please note that the loading of sourcecode files that is performed when
 processUncoveredFilesFromWhitelist="true" is set can cause problems when a
 sourcecode file contains code outside the scope of a class or function,
 for instance.


 Changing it to the following configuration allows for coverage to be run.

 {{{
 <filter>
     <whitelist addUncoveredFilesFromWhitelist="true">
         <directory suffix=".php">src</directory>
     </whitelist>
 </filter>
 }}}

 See tweet by Sebastian Bergmann (creator of PHPUnit):
 https://twitter.com/s_bergmann/status/495154142319747073

 This was added in https://core.trac.wordpress.org/changeset/37449

 Props for https://profiles.wordpress.org/schlessera for helping to find
 the problem and the solution.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43067>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list