test: add edge case tests for HAR file parsing#155
Merged
deviantintegral merged 3 commits intomainfrom Dec 16, 2025
Merged
Conversation
b93fa09 to
77a9167
Compare
Add test coverage for previously untested edge cases including: - Invalid JSON in HAR files - Incomplete/truncated JSON data - Missing required fields (missing "log" key) - Invalid structure (wrong types for fields) - Malformed entry data - Null values where objects are expected - Empty but valid HAR files - Minimal valid HAR structures - Corrupted binary data - Very large HAR files (100+ entries) - Whitespace-only files All malformed test fixtures are isolated in tests/fixtures/edge-cases/ to avoid interfering with existing fixture-based tests. These tests verify both error handling (proper exceptions thrown) and successful parsing of minimal/empty valid HAR files.
Replace generic \Exception assertions with specific exception types: - JMS\Serializer\Exception\RuntimeException for JSON parsing errors - TypeError for null values in typed properties - \Error for uninitialized property access This makes tests more precise and helps catch regressions where the wrong type of exception might be thrown.
Remove testMissingLogKeyResultsInUninitializedProperty() from EdgeCaseTest as commit 9d938fb properly fixed this issue by adding PostDeserialize validation in the Har class. The missing log key validation is now properly covered by MissingLogKeyTest.php which tests the correct behavior (exception thrown during deserialization). The old test was checking for the bug behavior (uninitialized property error when accessing getLog()), which no longer occurs.
b84dca4 to
b601ff8
Compare
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.
Add test coverage for previously untested edge cases including:
All malformed test fixtures are isolated in tests/fixtures/edge-cases/ to avoid interfering with existing fixture-based tests.
These tests verify both error handling (proper exceptions thrown) and successful parsing of minimal/empty valid HAR files.