jmrieger / php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.
Other
0 stars 0 forks source link

29 - Flag checking of path / branch coverage in CodeCoverage #31

Closed jmrieger closed 5 years ago

jmrieger commented 5 years ago

See title. Addresses #29

jmrieger commented 5 years ago

Without branch coverage flag:

/usr/local/Cellar/php@7.1/7.1.29/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /Users/jrieger/Projects/sebastianbergmann/phpunit/phpunit --coverage-text tests/unit/Util/JsonTest.php
PHPUnit 7.5.7-6-g0868d442d by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.29 with Xdebug 2.7.2
Configuration: /Users/jrieger/Projects/sebastianbergmann/phpunit/phpunit.xml

.......                                                             7 / 7 (100%)

Time: 3.92 seconds, Memory: 18.00 MB

OK (7 tests, 11 assertions)

Code Coverage Report:        
  2019-06-12 13:08:57        

 Summary:                    
  Classes:   0.70% (1/143)   
  Methods:   1.99% (24/1206) 
  Lines:     3.31% (299/9034)

\PHPUnit\Framework::PHPUnit\Framework\Assert
  Methods:   1.58% (  3/190)   Lines:   1.28% ( 12/935)
\PHPUnit\Framework::PHPUnit\Framework\Exception
  Methods:  25.00% (  1/  4)   Lines:  45.45% (  5/ 11)
\PHPUnit\Framework::PHPUnit\Framework\TestCase
  Methods:   7.94% ( 10/126)   Lines:  18.93% (142/750)
\PHPUnit\Framework::PHPUnit\Framework\TestResult
  Methods:   0.00% (  0/ 63)   Lines:   8.29% ( 31/374)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Constraint
  Methods:  28.57% (  2/  7)   Lines:  36.00% (  9/ 25)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Exception
  Methods:  50.00% (  2/  4)   Lines:  20.00% (  4/ 20)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\ExceptionMessage
  Methods:  25.00% (  1/  4)   Lines:  29.41% (  5/ 17)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\IsEqual
  Methods:  33.33% (  1/  3)   Lines:  21.95% (  9/ 41)
\PHPUnit\Util::PHPUnit\Util\Json
  Methods: 100.00% (  3/  3)   Lines: 100.00% ( 19/ 19)
\PHPUnit\Util::PHPUnit\Util\Test
  Methods:   3.23% (  1/ 31)   Lines:  13.18% ( 63/478)

Process finished with exit code 0
jmrieger commented 5 years ago

With --branch-coverage flag:

/usr/local/Cellar/php@7.1/7.1.29/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /Users/jrieger/Projects/sebastianbergmann/phpunit/phpunit --coverage-text --branch-coverage tests/unit/Util/JsonTest.php
PHPUnit 7.5.7-6-g0868d442d by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.29 with Xdebug 2.7.2
Configuration: /Users/jrieger/Projects/sebastianbergmann/phpunit/phpunit.xml

.......                                                             7 / 7 (100%)

Time: 6.85 seconds, Memory: 52.00 MB

OK (7 tests, 11 assertions)

Code Coverage Report:        
  2019-06-12 13:19:49        

 Summary:                    
  Classes:   0.70% (1/143)   
  Methods:   1.99% (24/1206) 
  Lines:     3.31% (299/9034)
  Branches: 100.00% (195/195)
  Paths:     0.41% (52/12604)

\PHPUnit\Framework::PHPUnit\Framework\Assert
  Methods:   1.58% (  3/190)   Lines:   1.28% ( 12/935)  Branches: 100.00% (  3/  3)   Paths: 100.00% (   3/   3)
\PHPUnit\Framework::PHPUnit\Framework\Exception
  Methods:  25.00% (  1/  4)   Lines:  45.45% (  5/ 11)  Branches: 100.00% (  4/  4)   Paths:  33.33% (   1/   3)
\PHPUnit\Framework::PHPUnit\Framework\TestCase
  Methods:   7.94% ( 10/126)   Lines:  18.93% (142/750)  Branches: 100.00% (107/107)   Paths:   0.55% (  25/4571)
\PHPUnit\Framework::PHPUnit\Framework\TestResult
  Methods:   0.00% (  0/ 63)   Lines:   8.29% ( 31/374)  Branches:         (  0/  0)   Paths:         (   0/   0)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Constraint
  Methods:  28.57% (  2/  7)   Lines:  36.00% (  9/ 25)  Branches: 100.00% (  7/  7)   Paths:  37.50% (   3/   8)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Exception
  Methods:  50.00% (  2/  4)   Lines:  20.00% (  4/ 20)  Branches: 100.00% (  2/  2)   Paths: 100.00% (   2/   2)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\ExceptionMessage
  Methods:  25.00% (  1/  4)   Lines:  29.41% (  5/ 17)  Branches: 100.00% (  3/  3)   Paths:  66.67% (   2/   3)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\IsEqual
  Methods:  33.33% (  1/  3)   Lines:  21.95% (  9/ 41)  Branches: 100.00% (  3/  3)   Paths:  40.00% (   2/   5)
\PHPUnit\Util::PHPUnit\Util\Json
  Methods: 100.00% (  3/  3)   Lines: 100.00% ( 19/ 19)  Branches: 100.00% ( 16/ 16)   Paths:  33.33% (   5/  15)
\PHPUnit\Util::PHPUnit\Util\Test
  Methods:   3.23% (  1/ 31)   Lines:  13.18% ( 63/478)  Branches: 100.00% ( 50/ 50)   Paths:   0.11% (   9/7994)

Process finished with exit code 0