test: add ZVecException isolation tests (closes #99)#155
Merged
Conversation
…ructor, chaining, and error details (closes #99) Added: - 4 unit .phpt tests covering getErrorCodeString() (codes 0-10, 99, -1), constructor parameter combinations, exception chaining (3 levels, Error, RuntimeException), and error detail boundary values (0, PHP_INT_MAX, empty strings, unicode, instance independence) - 1 integration .phpt test with real FFI round-trip errors: INVALID_ARGUMENT from open(), ALREADY_EXISTS from duplicate PK, invalid filter syntax, exception chaining with error details propagation - examples/08_error_handling.php demonstrating all error handling patterns All tests verified with `php run-tests.php -n tests/` — no regressions
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.
Description
Closes #99
Changes
ZVecExceptionclass:test_exception_error_code_string.phpt— getErrorCodeString() mapping for codes 0-10, 99, -1test_exception_constructor.phpt— parameter combinations (default, message, code, all params, partial details)test_exception_chaining.phpt— exception chaining with RuntimeException, ZVecException, custom Throwable, deep chaining (3 levels)test_exception_error_details.phpt— getErrorFile/Line/Function with boundary values (0, PHP_INT_MAX, empty strings, unicode, long paths, chaining preservation)test_exception_integration.phpt— real FFI round-trip errors (INVALID_ARGUMENT from open(), ALREADY_EXISTS from duplicate PK, invalid filter syntax, chaining with error details propagation)examples/08_error_handling.php— comprehensive error handling patterns demonstration (basic catching, error details, all code strings, chaining, try-finally pattern)Testing
php run-tests.php -n)Code Review