@@ -101,26 +101,6 @@ class PHP_CodeCoverage
101
101
*/
102
102
protected $ tests = array ();
103
103
104
- /**
105
- * @var boolean
106
- */
107
- protected $ isCodeCoverageTestSuite = FALSE ;
108
-
109
- /**
110
- * @var boolean
111
- */
112
- protected $ isFileIteratorTestSuite = FALSE ;
113
-
114
- /**
115
- * @var boolean
116
- */
117
- protected $ isTimerTestSuite = FALSE ;
118
-
119
- /**
120
- * @var boolean
121
- */
122
- protected $ isTokenStreamTestSuite = FALSE ;
123
-
124
104
/**
125
105
* Constructor.
126
106
*
@@ -141,23 +121,34 @@ public function __construct(PHP_CodeCoverage_Driver $driver = NULL, PHP_CodeCove
141
121
$ this ->driver = $ driver ;
142
122
$ this ->filter = $ filter ;
143
123
144
- if (defined ('PHP_CODECOVERAGE_TESTSUITE ' )) {
145
- $ this ->isCodeCoverageTestSuite = TRUE ;
124
+ // @codeCoverageIgnoreStart
125
+ if (!defined ('PHP_CODECOVERAGE_TESTSUITE ' )) {
126
+ $ this ->filter ->addFilesToBlacklist (php_codecoverage_autoload ());
146
127
}
147
128
148
- // @codeCoverageIgnoreStart
149
- if (defined ('FILE_ITERATOR_TESTSUITE ' )) {
150
- $ this ->isFileIteratorTestSuite = TRUE ;
129
+ if (!defined ('PHPUNIT_TESTSUITE ' )) {
130
+ $ this ->filter ->addFilesToBlacklist (phpunit_autoload ());
131
+ $ this ->filter ->addFilesToBlacklist (phpunit_dbunit_autoload ());
132
+ $ this ->filter ->addFilesToBlacklist (phpunit_mockobject_autoload ());
133
+ $ this ->filter ->addFilesToBlacklist (phpunit_selenium_autoload ());
134
+ $ this ->filter ->addFilesToBlacklist (phpunit_story_autoload ());
135
+ }
136
+
137
+ if (!defined ('FILE_ITERATOR_TESTSUITE ' )) {
138
+ $ this ->filter ->addFilesToBlacklist (file_iterator_autoload ());
151
139
}
152
140
153
- if (defined ('PHP_TIMER_TESTSUITE ' )) {
154
- $ this ->isTimerTestSuite = TRUE ;
141
+ if (!defined ('PHP_TIMER_TESTSUITE ' ) &&
142
+ function_exists ('php_timer_autoload ' )) {
143
+ $ this ->filter ->addFilesToBlacklist (php_timer_autoload ());
155
144
}
156
145
157
- if (defined ('PHP_TOKENSTREAM_TESTSUITE ' )) {
158
- $ this ->isTokenStreamTestSuite = TRUE ;
146
+ if (! defined ('PHP_TOKENSTREAM_TESTSUITE ' )) {
147
+ $ this ->filter -> addFilesToBlacklist ( php_tokenstream_autoload ()) ;
159
148
}
160
149
// @codeCoverageIgnoreEnd
150
+
151
+ $ this ->filter ->addFilesToBlacklist (text_template_autoload ());
161
152
}
162
153
163
154
/**
@@ -280,7 +271,6 @@ public function append(array $data, $id = NULL)
280
271
throw new InvalidArgumentException ;
281
272
}
282
273
283
- $ this ->applySelfFilter ($ data );
284
274
$ this ->applyListsFilter ($ data );
285
275
$ this ->initializeFilesThatAreSeenTheFirstTime ($ data );
286
276
$ this ->applyCoversAnnotationFilter ($ data , $ id );
@@ -443,54 +433,6 @@ protected function applyListsFilter(&$data)
443
433
}
444
434
}
445
435
446
- /**
447
- * Filters sourcecode files from PHP_CodeCoverage, PHP_TokenStream,
448
- * Text_Template, and File_Iterator.
449
- *
450
- * @param array $data
451
- * @codeCoverageIgnore
452
- */
453
- protected function applySelfFilter (&$ data )
454
- {
455
- foreach (array_keys ($ data ) as $ filename ) {
456
- if (!$ this ->filter ->isFile ($ filename )) {
457
- unset($ data [$ filename ]);
458
- continue ;
459
- }
460
-
461
- if (!$ this ->isCodeCoverageTestSuite &&
462
- strpos ($ filename , dirname (__FILE__ )) === 0 ) {
463
- unset($ data [$ filename ]);
464
- continue ;
465
- }
466
-
467
- if (!$ this ->isFileIteratorTestSuite &&
468
- (substr ($ filename , -17 ) == 'File/Iterator.php ' ||
469
- substr ($ filename , -25 ) == 'File/Iterator/Factory.php ' )) {
470
- unset($ data [$ filename ]);
471
- continue ;
472
- }
473
-
474
- if (!$ this ->isTimerTestSuite &&
475
- (substr ($ filename , -13 ) == 'PHP/Timer.php ' )) {
476
- unset($ data [$ filename ]);
477
- continue ;
478
- }
479
-
480
- if (!$ this ->isTokenStreamTestSuite &&
481
- (substr ($ filename , -13 ) == 'PHP/Token.php ' ||
482
- substr ($ filename , -20 ) == 'PHP/Token/Stream.php ' ||
483
- substr ($ filename , -35 ) == 'PHP/Token/Stream/CachingFactory.php ' )) {
484
- unset($ data [$ filename ]);
485
- continue ;
486
- }
487
-
488
- if (substr ($ filename , -17 ) == 'Text/Template.php ' ) {
489
- unset($ data [$ filename ]);
490
- }
491
- }
492
- }
493
-
494
436
/**
495
437
* @since Method available since Release 1.1.0
496
438
*/
0 commit comments