Close crucial test gaps found by a suite audit; fix doc slips - #4
Merged
Conversation
New tests, driven by cross-referencing the suite against Infection's escaped mutants: - MappingException on a 2xx body that fails DTO mapping (the SDK's known gotcha), asserting the request context and MappingError chain - both supported date formats (Z suffix and fractional seconds) - dates were previously entirely untested - MalformedResponseException when a 2xx body is valid JSON but not an array (only the invalid-JSON branch was covered) - a 202 Accepted operation response maps to Payment (matches the live-verified async behavior) - host-pinning guard edges: uppercase scheme/host and an explicit :443 default port are allowed - Content-Type stamping: absent on GET, a preset value is preserved - a 3xx row in the status-code provider - the non-payment callback test now asserts the guard's message, so removing the type guard can no longer hide behind the shape-mismatch path Also removes the dead $allowEmpty parameter of Client::decodeJson() (never passed true) and fixes two doc slips: updatePayment()'s docblock said PUT while the SDK sends PATCH, and the README's ValidationException example used a 3-char order id that would nowadays fail the 4-20 length rule instead of the duplicate check it narrates. The README now also states that unconditionally-required fields are required constructor arguments. Mutation score: MSI 72% -> 80%, covered MSI 76% -> 82%.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #4 +/- ##
============================================
+ Coverage 92.55% 97.00% +4.45%
+ Complexity 148 146 -2
============================================
Files 24 24
Lines 403 401 -2
============================================
+ Hits 373 389 +16
+ Misses 30 12 -18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
added a commit
that referenced
this pull request
Aug 6, 2026
The five protected helpers mixed three conventions: getOne/createOne (semantic verb + One), bare update, the noun operation, and the abbreviated putSub. Now every helper is either semanticVerb+One (typed single-resource CRUD) or httpVerb+target (transport helpers): - update -> updateOne - operation -> postOperation - putSub -> putSubResource Also fixes the class docblock's update() bullet, which said PUT while the helper sends PATCH (the same slip #4 fixed on updatePayment()). Internal-only rename: the helpers are protected, endpoint subclassing is explicitly unsupported, and all call sites live in PaymentsEndpoint.
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.
An audit of the test suite (cross-referenced against Infection's escaped mutants) plus a README/CLAUDE.md accuracy pass.
New tests
MappingExceptionon a 2xx body that fails DTO mappingMappingErrorchainZsuffix + fractional seconds)supportDateFormats()could silently breakdecodeJson()was coveredPaymentHTTPS://API.QUICKPAY.NET:443/…allowedLogicalAndmutant on the stamping conditionUnexpectedStatusCodeExceptionprovider rowCleanup / doc fixes
$allowEmptyparameter ofClient::decodeJson()— never passedtrueanywhere.updatePayment()docblock said PUT while the SDK sends PATCH (README/CLAUDE.md already said PATCH).ValidationExceptionexample usedorderId: 'dup'— 3 chars, which nowadays fails the live API's 4–20 length rule instead of the duplicate check the example narrates. Now'dup-order-1'.Result