THRIFT-5951: Improve PHP library unit test coverage#3432
Merged
Conversation
Client: php - Add TJSONProtocol comprehensive tests (scalar roundtrip, struct, map, list, set, message, nested) - Add BoundaryValuesTest for Binary, Compact and JSON protocols (integer, double, string, bool boundaries) - Add TransportErrorScenariosTest for transport error handling - Expand TForkingServer tests with PHPMock for pcntl_fork/pcntl_waitpid - Expand TException tests with rich field roundtrip (scalar, map, list, set, empty containers) - Expand TBinarySerializer tests with dataProvider and accelerated extension mocks - Refactor TSimpleJSONProtocol write tests into dataProvider-driven methods - Add missing factory tests (getTransport, new instance per call) - Consolidate test fixtures into Fixture/ directory with Test prefix - Rename ProcessorSpy to TestProcessor, add TestRichException and TestSerializerStruct fixtures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Client: php - Replace PHP_FLOAT_MAX/MIN/EPSILON with numeric literals (unavailable in PHP 7.1) - Use -9223372036854775807 instead of PHP_INT_MIN to avoid TCompactProtocol float-to-int overflow on PHP 8.5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Client: php - TCompactProtocol::writeI64() crashed on PHP 8.5 when encoding PHP_INT_MIN (-2^63) because negation overflows to float. Write the zigzag varint directly for this edge case. - Restore PHP_INT_MIN in BoundaryValuesTest (was workaround) - Add TODO for PHP_FLOAT_MAX/MIN/EPSILON literals (PHP 7.2+) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… 8.5 Client: php - Add getAccessibleMethod() to ReflectionHelper trait with PHP version check - Use it in TForkingServerTest instead of direct setAccessible() calls Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on PHP 8.5 Client: php - Add early return for PHP_INT_MIN in readI64For32BitArchitectureDataProvider to avoid -PHP_INT_MIN overflow (same pattern as TCompactProtocol fix) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sveneld
added a commit
to sveneld/thrift
that referenced
this pull request
May 2, 2026
THRIFT-5951: Improve PHP library unit test coverage Client: php - Add comprehensive protocol tests for TJSONProtocol, boundary values, transport errors, serializers and exceptions - Expand TForkingServer tests with PHPMock and ReflectionHelper access helpers - Add missing factory tests and consolidate reusable test fixtures under Fixture/ - Fix PHP_INT_MIN handling in TCompactProtocol::writeI64() on PHP 8.5 by encoding the zigzag varint edge case directly - Avoid PHP_INT_MIN negation overflow in TBinaryProtocolTest data provider - Document PHP_FLOAT_* literal compatibility TODOs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Improves PHP unit test coverage from ~81.8% to ~86.8% statement coverage.
New tests:
Expanded tests:
Refactoring:
707 tests, 1528 assertions, 0 errors, 5 skipped.
[skip ci]anywhere in the commit message to free up build resources.