File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -465,9 +465,25 @@ protected function applyListsFilter(&$data, $filterGroups)
465465 protected function applyCoversAnnotationFilter (&$ data , $ id )
466466 {
467467 if ($ id instanceof PHPUnit_Framework_TestCase) {
468+ $ testClassName = get_class ($ id );
468469 $ linesToBeCovered = PHP_CodeCoverage_Util::getLinesToBeCovered (
469- get_class ( $ id ) , $ id ->getName ()
470+ $ testClassName , $ id ->getName ()
470471 );
472+
473+ if ($ this ->mapTestClassNameToCoveredClassName &&
474+ empty ($ linesToBeCovered )) {
475+ $ testedClass = substr ($ testClassName , 0 , -4 );
476+
477+ if (class_exists ($ testedClass )) {
478+ $ class = new ReflectionClass ($ testedClass );
479+
480+ $ linesToBeCovered = array (
481+ $ class ->getFileName () => range (
482+ $ class ->getStartLine (), $ class ->getEndLine ()
483+ )
484+ );
485+ }
486+ }
471487 } else {
472488 $ linesToBeCovered = array ();
473489 }
You can’t perform that action at this time.
0 commit comments