@@ -126,56 +126,7 @@ public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCove
126126 $ this ->driver = $ driver ;
127127 $ this ->filter = $ filter ;
128128
129- // @codeCoverageIgnoreStart
130- if (!defined ('PHP_CODECOVERAGE_TESTSUITE ' )) {
131- $ this ->filter ->addFilesToBlacklist (php_codecoverage_autoload ());
132- }
133-
134- if (!defined ('PHPUNIT_TESTSUITE ' )) {
135- $ this ->filter ->addFilesToBlacklist (phpunit_autoload ());
136- $ this ->filter ->addFilesToBlacklist (phpunit_dbunit_autoload ());
137- $ this ->filter ->addFilesToBlacklist (phpunit_mockobject_autoload ());
138- $ this ->filter ->addFilesToBlacklist (phpunit_selenium_autoload ());
139- $ this ->filter ->addFilesToBlacklist (phpunit_story_autoload ());
140- }
141-
142- if (!defined ('FILE_ITERATOR_TESTSUITE ' )) {
143- $ this ->filter ->addFilesToBlacklist (file_iterator_autoload ());
144- }
145-
146- if (!defined ('PHP_INVOKER_TESTSUITE ' )) {
147- $ this ->filter ->addFilesToBlacklist (php_invoker_autoload ());
148- }
149-
150- if (!defined ('PHP_TIMER_TESTSUITE ' ) &&
151- function_exists ('php_timer_autoload ' )) {
152- $ this ->filter ->addFilesToBlacklist (php_timer_autoload ());
153- }
154-
155- if (!defined ('PHP_TOKENSTREAM_TESTSUITE ' )) {
156- $ this ->filter ->addFilesToBlacklist (php_tokenstream_autoload ());
157- }
158-
159- if (!defined ('SYMFONY_TESTSUITE ' )) {
160- $ file = PHP_CodeCoverage_Util::fileExistsInIncludePath (
161- 'SymfonyComponents/YAML/sfYaml.php '
162- );
163-
164- if ($ file ) {
165- $ this ->filter ->addFileToBlacklist ($ file );
166- }
167-
168- $ file = PHP_CodeCoverage_Util::fileExistsInIncludePath (
169- 'SymfonyComponents/YAML/sfYamlDumper.php '
170- );
171-
172- if ($ file ) {
173- $ this ->filter ->addFileToBlacklist ($ file );
174- }
175- }
176- // @codeCoverageIgnoreEnd
177-
178- $ this ->filter ->addFilesToBlacklist (text_template_autoload ());
129+ $ this ->prefillBlacklist ();
179130 }
180131
181132 /**
@@ -568,4 +519,47 @@ protected function processUncoveredFilesFromWhitelist()
568519
569520 $ this ->append ($ data , 'UNCOVERED_FILES_FROM_WHITELIST ' );
570521 }
522+
523+ /**
524+ * Prefills the blacklist with source files used by PHPUnit
525+ * and PHP_CodeCoverage.
526+ */
527+ protected function prefillBlacklist ()
528+ {
529+ $ functions = array (
530+ 'file_iterator_autoload ' ,
531+ 'php_codecoverage_autoload ' ,
532+ 'php_invoker_autoload ' ,
533+ 'php_timer_autoload ' ,
534+ 'php_tokenstream_autoload ' ,
535+ 'phpunit_autoload ' ,
536+ 'phpunit_dbunit_autoload ' ,
537+ 'phpunit_mockobject_autoload ' ,
538+ 'phpunit_selenium_autoload ' ,
539+ 'phpunit_story_autoload ' ,
540+ 'text_template_autoload '
541+ );
542+
543+ foreach ($ functions as $ function ) {
544+ if (function_exists ($ function )) {
545+ $ this ->filter ->addFilesToBlacklist ($ function ());
546+ }
547+ }
548+
549+ $ file = PHP_CodeCoverage_Util::fileExistsInIncludePath (
550+ 'SymfonyComponents/YAML/sfYaml.php '
551+ );
552+
553+ if ($ file ) {
554+ $ this ->filter ->addFileToBlacklist ($ file );
555+ }
556+
557+ $ file = PHP_CodeCoverage_Util::fileExistsInIncludePath (
558+ 'SymfonyComponents/YAML/sfYamlDumper.php '
559+ );
560+
561+ if ($ file ) {
562+ $ this ->filter ->addFileToBlacklist ($ file );
563+ }
564+ }
571565}
0 commit comments