expand test coverage with comprehensive unit and edge case tests #23
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.
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:
Test results: