Skip to content

test: add ZVecException isolation tests (closes #99)#155

Merged
s2x merged 1 commit into
mainfrom
feat/issue-99-zvec-exception-tests
Jul 6, 2026
Merged

test: add ZVecException isolation tests (closes #99)#155
s2x merged 1 commit into
mainfrom
feat/issue-99-zvec-exception-tests

Conversation

@s2x

@s2x s2x commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #99

Changes

  • Added 4 unit test files for ZVecException class:
    • test_exception_error_code_string.phpt — getErrorCodeString() mapping for codes 0-10, 99, -1
    • test_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)
  • Added 1 integration test:
    • 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)
  • Added examples/08_error_handling.php — comprehensive error handling patterns demonstration (basic catching, error details, all code strings, chaining, try-finally pattern)
  • Updated CHANGELOG.md

Testing

  • All 5 new tests PASS (php run-tests.php -n)
  • All existing tests pass (11 pre-existing failures unrelated to this change: ulimit/macOS, installer without php.ini, reranker formatting)
  • No test database leftovers
  • Example script runs correctly

Code Review

  • Passed subagent code review (3 minor issues fixed: missing zvec skip check, dead code removed, LOG_FILE restored with proper cleanup)
  • All review comments addressed

…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
@s2x s2x self-assigned this Jul 6, 2026
@s2x
s2x merged commit 6c527ae into main Jul 6, 2026
3 checks passed
@s2x
s2x deleted the feat/issue-99-zvec-exception-tests branch July 6, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TEST-001: ZVecException — No Isolation Tests

1 participant