-
Notifications
You must be signed in to change notification settings - Fork 16
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 $environments arguments to ping methods #73
add $environments arguments to ping methods #73
Conversation
I tried adding tests for pingHoneybadgerOnSuccess but that was not possible because all checks with --prefer-lower failed then, maybe this is the reason there was no tests for that method previously? Anyway, this is because before Laravel 8.0.0 the exitCode was not set at all for closure based schedules, and before 8.6.0 the exitCode was not set properly, so this makes it impossible to write a test for this that doesn't fall with But the onSuccess works with earlier versions (as you surely know), as long as it's not a callback as in the tests. I can add the tests again if you wish, but i think need some guidance then on how you want them done in that case to get them to pass in all checks. |
You can try including the tests and skipping them on lower versions. Something like: if (version_compare(app()->version(), '8.6.0', '<')) {
$this->markTestSkipped("Laravel < 8.6 doesn't set proper return codes.");
return;
} |
Thanks @shalvah , i have made the change in that fashion now, and I also added a bonus test for I also refactored the checks inside the macros to try and satisfy codeclimate, i think the first version i had was easier to read and the new version didn't make codeclimate happy anyway. |
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 like!👍
Eh, I agree. I don't believe in coding to the tool also. This works for me. Explicitness > unnecessary refactoring. |
@shalvah thanks for the feedback :) |
Status
READY
Description
Adds a second argument to the
thenPingHoneybadger
andpingHoneybadgerOnSuccess
methods that allows you to specify one or more environments when to checkin, it can be omitted to always checkin (current behaviour).The PR includes tests.
I also added a
string
typehint for the $id argument, which should be 100% backwards compatible since the Reporter checkin method already does the same typehint.Examples