PHPLIB-1689 Make the Atlas Search exception more specific
Fix PHPLIB-1689
Conditions imported from https://github.com/mongodb/laravel-mongodb/blob/a2b4ab86dfc9248050b2592d9830773ac335774e/src/Schema/Builder.php#L386-L395
Codecov Report
:x: Patch coverage is 76.08696% with 11 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 87.63%. Comparing base (82719c4) to head (1348e94).
:warning: Report is 1 commits behind head on v2.x.
:white_check_mark: All tests successful. No failed tests found.
Additional details and impacted files
@@ Coverage Diff @@
## v2.x #1794 +/- ##
============================================
- Coverage 87.74% 87.63% -0.11%
- Complexity 3185 3196 +11
============================================
Files 424 425 +1
Lines 6289 6332 +43
============================================
+ Hits 5518 5549 +31
- Misses 771 783 +12
| Flag | Coverage Δ | |
|---|---|---|
| 6.0-replica_set | 86.41% <76.08%> (+0.69%) |
:arrow_up: |
| 6.0-server | 82.43% <76.08%> (+0.72%) |
:arrow_up: |
| 6.0-sharded_cluster | 86.21% <76.08%> (+0.69%) |
:arrow_up: |
| 8.0-replica_set | 87.49% <67.39%> (-0.17%) |
:arrow_down: |
| 8.0-server | 83.21% <67.39%> (+0.65%) |
:arrow_up: |
| 8.0-sharded_cluster | 87.33% <67.39%> (-0.17%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Since mongo 6.0.11-ent, the $listSearchIndexes stage returns nothing, while the previous versions threw a server error. This makes it more complicated to test and detect.
I found a more reliable way to detect when Search indexes are supported.
And I made the test pass weither search indexes are supported or not: if there is an exception it must be a SearchIndexNotSupportedException.
Also fixed the exception for update and drop search index.