-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Advanced codecoverage #5922
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
Advanced codecoverage #5922
Conversation
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.
Please document changes and move settings from "advanced" level
enabled: [Asserts] | ||
coverage: | ||
enabled: true | ||
advanced: |
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.
I don't think "advanced" have any meaning here.
code coverge settings are already as advanced as possible 😄
so please add those settings to coverage
level and document them at CodeCoverage guide
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.
or maybe if I understood it wrong, please find a better name instead of "advanced"
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.
They are settings that are proxied directly to the underlying library; that is what makes them advanced.
Since we also have settings for the Codeception module I did not want to put them in the same namespace; it doesn't improve readability.
Currently we have these settings:
protected $defaultSettings = [
'enabled' => false,
'remote' => false,
'local' => false,
'xdebug_session' => 'codeception',
'remote_config' => null,
'show_uncovered' => false,
'c3_url' => null,
'work_dir' => null,
'cookie_domain' => null,
];
They are not the same, or even related to, the settings for the php-code-coverage
library. That is why they do not live in the same namespace.
I'm not gonna bother discussing the name here since I honestly don't care about it :), if you have any other suggestion I'd be happy to change it.
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.
so please add those settings to
coverage
level and document them at CodeCoverage guide
This is something I explicitly will not do. It would only serve as a duplicate of the underlying library documentation and will quickly grow out of date.
Instead I have referred to the source code of the library (since there is no documentation for all its configuration options). -- This leads us back to the original name: advanced
.
Basically this is a way for you to go deep into the inner workings and change stuff, it is advanced because it requires reading the library source code and because troubles from using it will likely not be supported by the Codeception community.
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.
@SamMousa
thanks, now I got the point. How about naming it "phpCodeCoverage" - which is just how you explained things.
coverage:
phpCodeCoverage:
# here go advanced settings
?
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 fine with me. Will change it after the weekend
|
||
if (isset($settings['coverage']['advanced'])) { | ||
foreach ($settings['coverage']['advanced'] as $key => $value) { | ||
$method = 'set' . ucfirst($key); |
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.
All set
methods will be removed in php-code-coverage 9.0.0 - https://github.com/sebastianbergmann/php-code-coverage/blob/master/ChangeLog.md#removed
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.
Ah, just checked the changes, will be simple to accommodate them.
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.
While the changes are simple to accomodate it means we must require php 7.3 and phpunit 9.3.
I am fine with upping this requirement, but I know others are not (@Naktibalda).
I will not spend time on creating multiple code paths just to accomodate older software versions as it goes against most of what I believe in; so I'm closing this PR.
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.
What about upping the version of the Codeception to justify upping the requirements? We're using Codeception in our projects whith parallel tests by splitting tests in group. That's crazy fast and convenient. And it's impossible to use phpCodeCoverage as it is now in the stable version of Codeception because we're getting incorrect results when merging code coverage. So we're stucked with using our fork with hacks.
Personally I don't see any problems requiring latest version of the main testing package and especially version of the language that was published almost 2 years ago.
Please consider adding this options of codeCoverage package as it is severly needed by many developers.
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.
I agree; but the reality is that the main contributors on Codeception need to support older PHP versions.
We do not have the capacity to maintain multiple versions at this time.
@SamMousa I think that these changes can be implemented in Codeception 5.0 And it is a one more reason to set lowest supported reason of PHPUnit to 9.0. |
Closes #5768 |
Replaced by #6423 |
This PR adds support for setting any code coverage setting via the advanced key:
It uses reflection to see if a setting is available and if so, it attempts to configure it. This means that it will work for current features as well.
Todo