-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fix mutation coverage #485
Conversation
8cb2355
to
701f013
Compare
Pull Request Test Coverage Report for Build 10633692680Details
💛 - Coveralls |
701f013
to
e526235
Compare
e526235
to
59cddb9
Compare
@@ -32,7 +32,8 @@ | |||
}, | |||
"DecrementInteger": { | |||
"ignore": [ | |||
"Psl\\DataStructure\\PriorityQueue::peek" | |||
"Psl\\DataStructure\\PriorityQueue::peek", | |||
"Psl\\DateTime\\TemporalConvenienceMethodsTrait::since" |
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.
-> Altering since() causes timeouts in the async component.
@@ -58,6 +60,7 @@ | |||
}, | |||
"Throw_": { | |||
"ignore": [ | |||
"Psl\\DateTime\\DateTime::__construct", |
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 impossible to test the InvalidArgumentExceptions that are being thrown. I'm wondering if it would make more sense to use the same checks from fromParts
in the constructor directly.
The constructor does a range check, the fromParts does a calendar (intl) check.
Both result in different type of exceptions with different messages.
Would it make sense to always go for the fromParts() checks instead?
* @psalm-suppress ImpureMethodCall | ||
*/ | ||
return Internal\create_intl_date_formatter($date_style, $time_style, null, $timezone ?? $this->getTimezone(), $locale) | ||
->format($timestamp->getSeconds() + ($timestamp->getNanoseconds() / NANOSECONDS_PER_SECOND)); | ||
->format($timestamp->getSeconds()); |
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 pattern does not represent nanoseconds.
it is not possible (to my knowledge) to get a timestamp to contain nanoseconds > NANOSECONDS_PER_SECOND - 1.
I did not find a case to cover this calculation
|
||
// $end is the sizeof($values), use static value for better performance. | ||
$end = 3; | ||
while ($end > 0 && $values[$end - 1][0] === '0') { |
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.
mutating the while's results in timeouts. I decided to go for a couple of simple if statements instead that results in the same behaviour.
This PR fixes the infection errors in CI (related to the DateTime component)