Priority: π‘ Medium
Description
src/Fetch/Support/RequestContext.php is 689 lines and serves as the immutable per-request state container. Every single HTTP request flows through it, yet it has no dedicated test file β it is only exercised indirectly when integration tests make full requests.
Testing it in isolation is valuable because:
- It is immutable (readonly properties), so constructor argument handling is the only path to test
- It has a complex set of constructor parameters with defaults, and it's easy for a refactor to change a default silently
- Any bug here affects every request made by the library
Current gap
No RequestContextTest.php in tests/Unit/.
Recommended Fix
Create tests/Unit/RequestContextTest.php covering:
- All constructor arguments β verify each property is set correctly when explicitly passed
- Default values β verify each optional parameter's default matches documented behavior
- Immutability β verify attempting to assign to a readonly property throws an
Error
- Type correctness β verify that passing invalid types (e.g., a negative timeout) surfaces an error at construction time (or document that it doesn't, so the behavior is explicit)
- Accessor methods β if any exist, verify they return the constructed values
Impact
Without these tests, a change to a constructor default (e.g., changing the default timeout from 30 to 0) is invisible until a production request times out immediately.
Priority: π‘ Medium
Description
src/Fetch/Support/RequestContext.phpis 689 lines and serves as the immutable per-request state container. Every single HTTP request flows through it, yet it has no dedicated test file β it is only exercised indirectly when integration tests make full requests.Testing it in isolation is valuable because:
Current gap
No
RequestContextTest.phpintests/Unit/.Recommended Fix
Create
tests/Unit/RequestContextTest.phpcovering:ErrorImpact
Without these tests, a change to a constructor default (e.g., changing the default timeout from
30to0) is invisible until a production request times out immediately.