-
-
Notifications
You must be signed in to change notification settings - Fork 74
unit testing improvement #51
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
Conversation
Current coverage is 97.17% (diff: 100%)
|
if codecov-io adds a comment each time the PR is updated, this is a no-go IMO. It is spammy. |
@@ -1,7 +1,5 @@ | |||
language: php | |||
|
|||
sudo: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default value for sudo
is not always false actually. It depends on repositories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have been confused this for a long time.
Would you please provide some references about this?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's false for this repo by default though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alcohol but it makes it harder to copy-paste the config elsewhere (composer has some repository where it is not the default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi all, I think the proper way is adding the sudo: false
for each time so that it can always make sure that it's running on the non-root environment.
What do you think?
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I prefer being explicit too, as it does not require knowing at which date the repo started using Travis (this info is not available anywhere except in the Travis database AFAIK, and we cannot access it)
@@ -20,10 +18,14 @@ php: | |||
|
|||
matrix: | |||
fast_finish: true | |||
allow_failures: | |||
- php: hhvm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why ? it is passing in master, so there is no reason to allow it to fail. If your changes are breaking things, you should fix your contribution instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HHVM
is failed because it doesn't support the ReflectionClass
.
I use this feature because I want to test some methods directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stof, thank you for your suggestions again.
Now the HHVM is fixed and remove the allow_failures
.
Thanks.
{ | ||
$expectedString = 'pretty string'; | ||
$constraint = new \ReflectionClass('\Composer\Semver\Constraint\AbstractConstraint'); | ||
$setPrettyString = $constraint->getMethod('setPrettyString'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be much better to test this through the public API instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I know, the AbstractConstraintTest
is deprecated abstract class so I just use the ReflectionClass to test the trigger_error
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As they are public method, you should just create a child class extending the abstract class and use the public API if you want to cover these methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your tips.
Fix it.
protected function tearDown() | ||
{ | ||
unset($this->versionProvide); | ||
unset($this->emptyConstraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not unset the class properties. You should only reset their values (or do nothing as there is no circular dependency with the TestCase, so the refcounting will work fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I will fix it later.
Hi @stof. Thank you for your comment, I just want to show the code coverage report so I add the codecov-io service. The owner can remove this and it's up to them. The PR is updated each time that I think it's not a important problem. |
@peter279k each time there is a comment, maintainers receive an email. Gettings lots of emails just because the service reports the coverage status (which will only change in minor ways) is just spam IMO. github has better ways for automated systems to report an info for the PR (the status API) |
Hi @stof, you're right. This should have the spam mail problem. |
- composer install --no-interaction --no-progress --prefer-dist | ||
|
||
script: | ||
- vendor/bin/phpunit | ||
- vendor/bin/phpunit -d error_reporting=16384 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add -d option for hhvm
Guess it is related to hhvm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Please refer this issue.
Thanks.
I think it'd be great to have the new tests in a separate PR as that is clearly an improvement.. The code coverage stuff though I am not so sure. I am not a fan of such metrics as they tend to incentivize the wrong things if they're displayed too prominently. Code coverage is a tool and that's available to anyone willing to improve the test suite by locally enabling it when running phpunit |
Hi @Seldaek. You're right and I also am not the fan of code metric. Thanks. |
What's the status here. This should probably go through first, before I (or anyone else) looks to finish #74. |
I'll merge the tests and skip the rest.. You can work on #74 based on that assumption if it helps. |
I'll look at that PR next week (hopefully!). :) |
Change log
Improve the unit testing and code coverage.
the travis-ci status is available here.
the code coverage report is available here.
Fix the error in
.php_cs
.In PHP-CS-Fixer version 2.0.0, removing some configurations because they are not available. And fix the class not found error. (please see this issue).