File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,11 @@ class PHP_CodeCoverage
8080 */
8181 private $ ignoredLines = array ();
8282
83+ /**
84+ * @var bool
85+ */
86+ private $ disableIgnoredLines = false ;
87+
8388 /**
8489 * Test data.
8590 *
@@ -486,6 +491,22 @@ public function setProcessUncoveredFilesFromWhitelist($flag)
486491 $ this ->processUncoveredFilesFromWhitelist = $ flag ;
487492 }
488493
494+ /**
495+ * @param boolean $flag
496+ * @throws PHP_CodeCoverage_Exception
497+ */
498+ public function setDisableIgnoredLines ($ flag )
499+ {
500+ if (!is_bool ($ flag )) {
501+ throw PHP_CodeCoverage_Util_InvalidArgumentHelper::factory (
502+ 1 ,
503+ 'boolean '
504+ );
505+ }
506+
507+ $ this ->disableIgnoredLines = $ flag ;
508+ }
509+
489510 /**
490511 * Applies the @covers annotation filtering.
491512 *
@@ -661,6 +682,11 @@ private function getLinesToBeIgnored($filename)
661682 $ lines = file ($ filename );
662683 $ numLines = count ($ lines );
663684
685+ if ($ this ->disableIgnoredLines )
686+ {
687+ return $ this ->ignoredLines [$ filename ];
688+ }
689+
664690 foreach ($ lines as $ index => $ line ) {
665691 if (!trim ($ line )) {
666692 $ this ->ignoredLines [$ filename ][] = $ index + 1 ;
Original file line number Diff line number Diff line change 3434 */
3535class PHP_CodeCoverageTest extends PHP_CodeCoverage_TestCase
3636{
37+ /**
38+ * @var PHP_CodeCoverage
39+ */
3740 private $ coverage ;
3841
3942 protected function setUp ()
@@ -472,4 +475,20 @@ private function getLinesToBeIgnored()
472475
473476 return $ getLinesToBeIgnored ;
474477 }
478+
479+ /**
480+ * @covers PHP_CodeCoverage::getLinesToBeIgnored
481+ */
482+ public function testGetLinesToBeIgnoredWhenIgnoreIsDisabled ()
483+ {
484+ $ this ->coverage ->setDisableIgnoredLines (true );
485+
486+ $ this ->assertEquals (
487+ array (),
488+ $ this ->getLinesToBeIgnored ()->invoke (
489+ $ this ->coverage ,
490+ TEST_FILES_PATH . 'source_with_ignore.php '
491+ )
492+ );
493+ }
475494}
You can’t perform that action at this time.
0 commit comments