Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: generate also html coverage reports when running script 'test' #8266

Closed
wants to merge 16 commits into from

Conversation

NicolaeIotu
Copy link
Contributor

@NicolaeIotu NicolaeIotu commented Nov 28, 2023

When running 'composer test', if XDebug is installed and setup (xdebug.mode = coverage), in addition to the file build/logs/clover.xml, generate also nice html coverage reports in folder build/coverage.

PHPunit runs normally if XDebug is missing or it is not set for coverage.

View the coverage report at build/coverage/index.html.

Description
Explain what you have changed, and why.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

kenjis and others added 12 commits November 27, 2023 05:53
Co-authored-by: Samuel Asor <8720569+sammyskills@users.noreply.github.com>
When running 'composer test', if XDebug is installed and setup (xdebug.mode = coverage), in addition to the file build/logs/clover.xml, generate also nice html coverage reports in folder build/coverage.

PHPunit runs normally if XDebug is missing or it is not set for coverage.

View the coverage report at build/coverage/index.html.
@paulbalandan
Copy link
Member

Why not just add it to the phpunit.xml.dist so locally it can be seen too?

…l.dist

Changed destination folder to build/coverage/html.

Inline with framework requirements added setting highLowerBound with value 80
@NicolaeIotu
Copy link
Contributor Author

Good idea. Thank you.

@kenjis
Copy link
Member

kenjis commented Nov 28, 2023

I'm fine with this change.
Can you also update the README?
https://github.com/codeigniter4/CodeIgniter4/blob/develop/tests/README.md#generating-code-coverage

@kenjis kenjis added the 4.5 label Nov 28, 2023
@NicolaeIotu
Copy link
Contributor Author

Okay. I'm on it.

Comment on lines +38 to +39
<html outputDirectory="tests/coverage" highLowerBound="80"/>
<text outputFile="tests/coverage.txt"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like to put files in tests/ because it is for test code.
Use build/ instead.

@@ -25,14 +25,14 @@
class PagerRenderer
{
/**
* First page number.
* First page number in the set of links to be displayed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seemed to do something wrong with git.
Please get rid of unrelated commits from this PR.

@NicolaeIotu
Copy link
Contributor Author

I will do another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants