Skip to content

Conversation

@jmrieger
Copy link
Owner

@jmrieger jmrieger commented Jun 10, 2019

Based on #27 (25-directory-node-path-support)

Addresses #2

Changes

  • Add support for both path & branch coverage to Text reporter
  • Modify Util to pad spacing if no percentage is to be reported, $asString is true, and $fixedWidth is true
  • Several bugfixes

@jmrieger jmrieger requested a review from jamesthomasonjr June 10, 2019 19:20
@jmrieger
Copy link
Owner Author

Example output:

/usr/local/Cellar/[email protected]/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-4-g1f2ed4b39 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: 7.45 seconds, Memory: 48.00 MB

OK (7 tests, 11 assertions)


Code Coverage Report:        
  2019-06-10 19:16:06        
                             
 Summary:                    
  Classes:  100.00% (10/10)  
  Methods:  100.00% (52/52)  
  Lines:    100.00% (299/299)
  Branches: 100.00% (195/195)
  Paths:     0.41% (52/12604)

\PHPUnit\Framework::PHPUnit\Framework\Assert
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 12/ 12)   Branches: 100.00% (  3/  3)   Paths: 100.00% (   3/   3)
\PHPUnit\Framework::PHPUnit\Framework\Exception
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  5/  5)   Branches: 100.00% (  4/  4)   Paths:  33.33% (   1/   3)
\PHPUnit\Framework::PHPUnit\Framework\TestCase
  Methods: 100.00% (25/25)   Lines: 100.00% (142/142)   Branches: 100.00% (107/107)   Paths:   0.55% (  25/4571)
\PHPUnit\Framework::PHPUnit\Framework\TestResult
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% ( 31/ 31)   Branches:         (  0/  0)   Paths:         (   0/   0)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Constraint
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  9/  9)   Branches: 100.00% (  7/  7)   Paths:  37.50% (   3/   8)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\Exception
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  4/  4)   Branches: 100.00% (  2/  2)   Paths: 100.00% (   2/   2)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\ExceptionMessage
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  5/  5)   Branches: 100.00% (  3/  3)   Paths:  66.67% (   2/   3)
\PHPUnit\Framework\Constraint::PHPUnit\Framework\Constraint\IsEqual
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  9/  9)   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: 100.00% (10/10)   Lines: 100.00% ( 63/ 63)   Branches: 100.00% ( 50/ 50)   Paths:   0.11% (   9/7994)

Process finished with exit code 0

@jmrieger
Copy link
Owner Author

Hmmm, there's a lot of false positive here. The following is run on phpunit tag 7.5 and php-code-coverage tag 6.0

/usr/local/Cellar/[email protected]/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-2-g06df2aab7 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: 4.25 seconds, Memory: 18.00 MB

OK (7 tests, 11 assertions)


Code Coverage Report:       
  2019-06-11 12:11:53       
                            
 Summary:                   
  Classes:  0.70% (1/143)   
  Methods:  1.99% (24/1206) 
  Lines:    3.31% (299/9025)

\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
Copy link
Owner Author

Fixed the issues above. New output below. Note that there are additional lines reported in the summary - this is to be expected, since I added new lines to phpunit/phpunit to support the branch coverage flag.

/usr/local/Cellar/[email protected]/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: 4.16 seconds, Memory: 18.00 MB

OK (7 tests, 11 assertions)


Code Coverage Report:        
  2019-06-12 12:38:08        
                             
 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 jmrieger merged commit f2dfe43 into 25-directory-node-path-support Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants