tests: fill coverage gaps in filters, listeners, middleware, model#350
Open
tests: fill coverage gaps in filters, listeners, middleware, model#350
Conversation
Fill gaps in the test suite for areas that had meaningful logic but no direct coverage: - ScheduleStatusFilter: single/multi-value and invalid-input branches - WebhookCallEventListener: attempt persistence and success-rate recalc - WebhookAttempt: isSuccess(), whereSuccessful scope, prunable() - SetAppLocale middleware: user/no-user and preferred-locale fallback Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fills gaps in the test suite for classes that had meaningful logic but no direct coverage. Walked the
src/tree against thetests/tree and targeted the units where branches were going unexercised.ScheduleStatusFilter— single-value, enum-instance, invalid value, multi-value, and mixed-validity input branches. Existing API feature tests only exercised the happy path.WebhookCallEventListener— persistsWebhookAttemptrows fromWebhookCallSucceededEvent/WebhookCallFailedEventand triggers the subscription success-rate recalculation. Previously only tested transitively.WebhookAttemptmodel —isSuccess()across 2xx/non-2xx,whereSuccessfulscope, andprunable()respectingcachet.webhooks.logs.prune_logs_after_days.SetAppLocalemiddleware — no-user passthrough, authenticated user'spreferredLocale(), and fallback toAccept-Languagewhen the user has no preferred locale set.No production code changed. Full suite: 406 passing.
Test plan
vendor/bin/pest tests/Unit/Filters/ScheduleStatusFilterTest.phpvendor/bin/pest tests/Unit/Listeners/WebhookCallEventListenerTest.phpvendor/bin/pest tests/Unit/Models/WebhookAttemptTest.phpvendor/bin/pest tests/Unit/Http/Middleware/SetAppLocaleTest.phpphp -d memory_limit=512M vendor/bin/pest(full suite)🤖 Generated with Claude Code