7171class PHP_CodeCoverageTest extends PHP_CodeCoverage_TestCase
7272{
7373 protected $ coverage ;
74- protected $ getLinesToBeIgnored ;
7574
7675 protected function setUp ()
7776 {
7877 $ this ->coverage = new PHP_CodeCoverage ;
79-
80- $ this ->getLinesToBeIgnored = new ReflectionMethod (
81- 'PHP_CodeCoverage ' , 'getLinesToBeIgnored '
82- );
83-
84- $ this ->getLinesToBeIgnored ->setAccessible (TRUE );
8578 }
8679
8780 /**
@@ -383,7 +376,7 @@ public function testGetLinesToBeIgnored()
383376 38 ,
384377 39
385378 ),
386- $ this ->getLinesToBeIgnored ->invoke (
379+ $ this ->getLinesToBeIgnored () ->invoke (
387380 $ this ->coverage ,
388381 TEST_FILES_PATH . 'source_with_ignore.php '
389382 )
@@ -397,7 +390,7 @@ public function testGetLinesToBeIgnored2()
397390 {
398391 $ this ->assertEquals (
399392 array (1 , 5 ),
400- $ this ->getLinesToBeIgnored ->invoke (
393+ $ this ->getLinesToBeIgnored () ->invoke (
401394 $ this ->coverage ,
402395 TEST_FILES_PATH . 'source_without_ignore.php '
403396 )
@@ -421,7 +414,7 @@ public function testGetLinesToBeIgnored3()
421414 7 => 19 ,
422415 8 => 20
423416 ),
424- $ this ->getLinesToBeIgnored ->invoke (
417+ $ this ->getLinesToBeIgnored () ->invoke (
425418 $ this ->coverage ,
426419 TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php '
427420 )
@@ -462,10 +455,24 @@ public function testGetLinesToBeIgnoredOneLineAnnotations()
462455 24 => 33 ,
463456 25 => 36
464457 ),
465- $ this ->getLinesToBeIgnored ->invoke (
458+ $ this ->getLinesToBeIgnored () ->invoke (
466459 $ this ->coverage ,
467460 TEST_FILES_PATH . 'source_with_oneline_annotations.php '
468461 )
469462 );
470463 }
464+
465+ /**
466+ * @return ReflectionMethod
467+ */
468+ private function getLinesToBeIgnored ()
469+ {
470+ $ getLinesToBeIgnored = new ReflectionMethod (
471+ 'PHP_CodeCoverage ' , 'getLinesToBeIgnored '
472+ );
473+
474+ $ getLinesToBeIgnored ->setAccessible (TRUE );
475+
476+ return $ getLinesToBeIgnored ;
477+ }
471478}
0 commit comments