THRIFT-5951: Add PHP runtime coverage tests#3405
Open
sveneld wants to merge 1 commit intoapache:masterfrom
Open
THRIFT-5951: Add PHP runtime coverage tests#3405sveneld wants to merge 1 commit intoapache:masterfrom
sveneld wants to merge 1 commit intoapache:masterfrom
Conversation
967d949 to
4357726
Compare
Client: php Generated-by: Codex GPT-5.4
kpumuk
reviewed
Apr 17, 2026
| $transport->expects($this->exactly(2)) | ||
| ->method('readAll') | ||
| ->withConsecutive([4], [2]) | ||
| ->willReturnOnConsecutiveCalls(pack('N', 2), '12'); |
Member
There was a problem hiding this comment.
There is something weird going on here with mocks. readAll returns strings, but skipBinary() does math on it:
return 4 + $itrans->readAll($len);In this case since we return '12' as a string, 4 + '12' will be 16. Curious how does it even work...
Member
There was a problem hiding this comment.
What happens if you return 'aa' instead of '12'?
Edit:
There was 1 error:
1) Test\Thrift\Unit\Lib\Protocol\TProtocolTest::testSkipBinarySkipsPrimitiveAndContainerValues
TypeError: Unsupported operand types: int + string
/thrift/src/lib/php/lib/Protocol/TProtocol.php:289
/thrift/src/lib/php/test/Unit/Lib/Protocol/TProtocolTest.php:190
ERRORS!
Tests: 222, Assertions: 462, Errors: 1, Skipped: 5.
I think we have a bug in the protocol implementation, and that the test does not actually test the right thing due to mocks and inputs creatively crafted around the bug.
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.
Summary
lib/php/libTBase,TProtocolskip paths,TMultiplexedProcessor,StoredMessageProtocol, base server/transport abstractions, JSON/SimpleJSON helper contexts,TApplicationException, and constant/type classesNotes
LICENSEandNOTICEare unchangedValidation
docker run --rm -v "$PWD:/src" -w /src php:8.3-cli php vendor/bin/phpunit -c lib/php/phpunit.xml --filter '/(TBaseTest|TProtocolTest|TMultiplexedProcessorTest|StoredMessageProtocolTest|TServerTest|TServerTransportTest|TTransportTest|JsonContextTest|SimpleJsonContextTest|TApplicationExceptionTest|ExceptionTypesTest|TypeConstantsTest)/' lib/php/test/Unit/Libdocker run --rm -v "$PWD:/src" -w /src php:8.3-cli sh -lc 'for f in lib/php/test/Unit/Lib/Base/TBaseTest.php lib/php/test/Unit/Lib/Protocol/TProtocolTest.php lib/php/test/Unit/Lib/TMultiplexedProcessorTest.php lib/php/test/Unit/Lib/StoredMessageProtocolTest.php lib/php/test/Unit/Lib/Server/TServerTest.php lib/php/test/Unit/Lib/Server/TServerTransportTest.php lib/php/test/Unit/Lib/Transport/TTransportTest.php lib/php/test/Unit/Lib/Protocol/JsonContextTest.php lib/php/test/Unit/Lib/Protocol/SimpleJsonContextTest.php lib/php/test/Unit/Lib/Exception/TApplicationExceptionTest.php lib/php/test/Unit/Lib/Exception/ExceptionTypesTest.php lib/php/test/Unit/Lib/Type/TypeConstantsTest.php; do php -l "$f" || exit 1; done'Generated-by: Codex GPT-5.4