Skip to content

Conversation

@peter279k
Copy link
Contributor

It's just for this issue.

@codecov-io
Copy link

codecov-io commented Feb 21, 2018

Codecov Report

Merging #10 into master will increase coverage by 32.23%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #10 +/- ## ============================================= + Coverage 51.09% 83.33% +32.23%  Complexity 32 32 ============================================= Files 4 4 Lines 137 84 -53 ============================================= Hits 70 70 + Misses 67 14 -53
Impacted Files Coverage Δ Complexity Δ
src/PhpUnit5Printer.php 0% <0%> (ø) 5% <0%> (ø) ⬇️
src/Printer.php 98.24% <0%> (+33.12%) 22% <0%> (ø) ⬇️
src/PhpUnit6Printer.php 100% <0%> (+43.47%) 5% <0%> (ø) ⬇️
src/ImmediateExceptionPrinter.php 100% <0%> (+80%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df2b810...5d74d9d. Read the comment docs.

composer.json Outdated
},
"scripts": {
"test": "phpunit -c test"
"test": "php vendor/bin/phpunit -c test/phpunit.xml"
Copy link
Member

Choose a reason for hiding this comment

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

This line should be functionally equivalent to the previous one. How does this fix code coverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

phpunit command option -c means --configuration.
And I just specify the current path of phpunit.xml.

Copy link
Member

Choose a reason for hiding this comment

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

PHPUnit looks in the specified directory for phpunit.xml, so it should do the same thing. This pattern is used in other projects and works fine: https://github.com/ScriptFUSION/Porter/blob/master/composer.json#L39. For some reason, (probably because the tests are PHPT format,) it just doesn't work in this project. I cannot deny your change seems to fix the issue, but I suspect there's still a bug in PHPUnit itself.

If specifying the config file explicitly fixes the issue, does that mean the php vendor/bin/ change isn't needed?

composer.json Outdated
"require": {
"phpunit/phpunit": "^5.5|^6"
"php": ">=5.6",
"phpunit/phpunit": "^5.5|^6.5"
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that the PHPUnit require 5.5+ or 6.5+.
So I add the required PHP version >=5.6 to check whether the environment is the correct PHP version.

Copy link
Member

Choose a reason for hiding this comment

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

The environment check is fine, but why does the ^6 constraint need changing to ^6.5?

Copy link
Contributor Author

@peter279k peter279k Feb 21, 2018

Choose a reason for hiding this comment

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

Because I want to let PHPUnit be the latest version.

Copy link
Member

Choose a reason for hiding this comment

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

That doesn't make sense. ^6 already permits the latest version; ^6.5 just prevents earlier versions, which is not desirable unless you can prove it's necessary to fix this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right, I will add the PHPUnit version back.

@Bilge Bilge mentioned this pull request Feb 21, 2018
@Bilge
Copy link
Member

Bilge commented Feb 21, 2018

As I just proved in #11, these changes do not improve coverage. The coverage issue that used to exist has since been fixed by external changes in PHPUnit, Codecov or something else. The only change I'd be willing to merge here is the PHP version constraint in Composer.

Copy link
Member

@Bilge Bilge left a comment

Choose a reason for hiding this comment

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

Thanks, Peter 👍

@Bilge Bilge changed the title Fix code coverage Add PHP version constraint to Composer Feb 22, 2018
@Bilge Bilge merged commit de2f8a0 into ScriptFUSION:master Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants