Skip to content

test: add immutability tests for CloneRemoval mutations#160

Merged
deviantintegral merged 2 commits intomainfrom
claude/add-infection-testing-0Rz2Z
Dec 17, 2025
Merged

test: add immutability tests for CloneRemoval mutations#160
deviantintegral merged 2 commits intomainfrom
claude/add-infection-testing-0Rz2Z

Conversation

@deviantintegral
Copy link
Owner

@deviantintegral deviantintegral commented Dec 16, 2025

Added tests to ensure that PSR-7 with* methods properly clone underlying objects and maintain immutability.

Added comprehensive tests to ensure that PSR-7 with* methods properly
clone underlying objects and maintain immutability:

- Request: withHeader, withoutHeader, withAddedHeader, withRequestTarget,
  withMethod, withUri, withBody, getHarRequest, constructor
- Response: withStatus, withBody, getHarResponse
- ServerRequest: withCookieParams, withQueryParams, withParsedBody

Also added phpunit.xml without external XSD schema reference to avoid
network dependency issues during testing.

These tests ensure that calling with* methods returns new instances
and doesn't modify the original object, which is critical for PSR-7
immutability requirements.
Added tests to verify that methods returning arrays properly return
all items, not just a single item:

- ServerRequest.getCookieParams: Test with multiple cookies
- ServerRequest.getQueryParams: Test with multiple query parameters

These tests ensure that array mutation testing catches cases where
array methods might incorrectly return only one item.

Also added infection artifacts to .gitignore.
@deviantintegral deviantintegral force-pushed the claude/add-infection-testing-0Rz2Z branch from 188ebec to 546cd54 Compare December 17, 2025 15:27
@deviantintegral deviantintegral marked this pull request as ready for review December 17, 2025 15:30
@deviantintegral deviantintegral merged commit 6f62090 into main Dec 17, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants