Skip to content

Conversation

@ginkelsoft-development
Copy link
Owner

This commit significantly expands the test suite to improve code quality and reliability. The test coverage has increased from 5 to 60 tests.

New test files added:

  • tests/Unit/NormalizerTest.php: Validates text normalization logic including lowercasing, diacritic removal, special character handling, null/empty string handling, and international character support.

  • tests/Unit/TokensTest.php: Tests token generation for both exact and prefix matching, including SHA-256 hash validation, deterministic behavior, pepper variation, UTF-8 support, and error handling.

  • tests/Unit/EncryptedSearchAttributeTest.php: Validates the PHP 8 attribute configuration including default values, custom settings, and toArray() conversion.

  • tests/Unit/ElasticsearchServiceTest.php: Tests HTTP interactions with Elasticsearch including document indexing, deletion, searching, and delete-by-query operations with proper mocking and error handling.

  • tests/Feature/HasEncryptedSearchIndexEdgeCasesTest.php: Comprehensive edge case testing including empty/null values, special characters, normalization consistency, prefix search boundaries, and field update behavior.

Bug fixes:

  • Fixed syntax error in HasEncryptedSearchIndex.php (line 301)
  • Corrected ElasticsearchService test expectations (boolean returns)
  • Fixed Normalizer test assertion for international characters

Test results:

  • 60 tests passing
  • 108 assertions
  • Covers all major components and edge cases

This commit significantly expands the test suite to improve code quality
and reliability. The test coverage has increased from 5 to 60 tests.

New test files added:
- tests/Unit/NormalizerTest.php: Validates text normalization logic
  including lowercasing, diacritic removal, special character handling,
  null/empty string handling, and international character support.

- tests/Unit/TokensTest.php: Tests token generation for both exact and
  prefix matching, including SHA-256 hash validation, deterministic
  behavior, pepper variation, UTF-8 support, and error handling.

- tests/Unit/EncryptedSearchAttributeTest.php: Validates the PHP 8
  attribute configuration including default values, custom settings,
  and toArray() conversion.

- tests/Unit/ElasticsearchServiceTest.php: Tests HTTP interactions with
  Elasticsearch including document indexing, deletion, searching, and
  delete-by-query operations with proper mocking and error handling.

- tests/Feature/HasEncryptedSearchIndexEdgeCasesTest.php: Comprehensive
  edge case testing including empty/null values, special characters,
  normalization consistency, prefix search boundaries, and field update
  behavior.

Bug fixes:
- Fixed syntax error in HasEncryptedSearchIndex.php (line 301)
- Corrected ElasticsearchService test expectations (boolean returns)
- Fixed Normalizer test assertion for international characters

Test results:
- 60 tests passing
- 108 assertions
- Covers all major components and edge cases
@ginkelsoft-development ginkelsoft-development merged commit 19b5f5a into develop Oct 13, 2025
2 of 8 checks passed
ginkelsoft-development added a commit that referenced this pull request Oct 14, 2025
…overage

expand test coverage with comprehensive unit and edge case tests
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.

2 participants