fix(php): strip .000 milliseconds from WireMock datetime query params#13450
Merged
iamnamananand996 merged 1 commit intomainfrom Mar 12, 2026
Merged
Conversation
PHP's DateTimeInterface::RFC3339 format omits fractional seconds (e.g., 2022-01-02T00:00:00Z) while mock-utils generates datetime values with milliseconds via Date.toISOString() (e.g., 2022-01-02T00:00:00.000Z). Since WireMock's equalTo matcher is exact-match, the stubs never fired for endpoints with datetime query parameters. This follows the same approach used by the Python generator.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
🌱 Seed Test SelectorSelect languages to run seed tests for:
How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR. |
amckinney
approved these changes
Mar 12, 2026
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.
Description
Refs: getbrevo/brevo-php#109
Fixes a datetime format mismatch between WireMock stubs and PHP SDK serialization that causes wire tests to fail. The shared
mock-utilspackage generates datetime query parameter values usingDate.toISOString()(e.g.,2022-01-02T00:00:00.000Z), but PHP'sDateTimeInterface::RFC3339format omits fractional seconds (e.g.,2022-01-02T00:00:00Z). Since WireMock'sequalTois an exact-match comparator, stubs for endpoints with datetime query parameters never fire.Link to Devin Session
Requested by: @iamnamananand996
Changes Made
stripDatetimeMillisecondsstatic method toWireTestSetupGeneratorthat strips.000from datetime-formatted query parameter values in WireMock stub mappings before writingwiremock-mappings.jsongenerators/python-v2/sdk/src/wire-tests/WireTestSetupGenerator.ts)Testing
pnpm run check)Review Checklist
equalTomatchers, those would still mismatch. Verify this is sufficient for the reported issue..000— non-zero fractional seconds (e.g.,.500Z) are intentionally left untouched. This is correct since PHP's RFC3339 drops all fractional seconds, but would still cause a mismatch if the IR contains datetimes with non-zero millis. Unlikely in practice since autogenerated examples typically use round seconds.mock-utils— the fix is scoped to the PHP generator's post-processing step, avoiding impact on other generators.