InteractsWithMeilisearch
trait InteractsWithMeilisearch
Add Meilisearch support to an integration test.
Use this trait on a test case and set MEILISEARCH_HOST. MEILISEARCH_PORT and MEILISEARCH_KEY may also be configured. Test indexes are isolated and cleaned up using a TEST_TOKEN-based prefix.
Properties
| protected string | $meilisearchTestPrefix | The test prefix for index isolation. |
|
| protected Client|null | $meilisearch | The Meilisearch client instance. |
Methods
Set up Meilisearch for testing (auto-called by setUpTraits).
Tear down Meilisearch (auto-called via beforeApplicationDestroyed).
Initialize the Meilisearch client.
Compute the test prefix for parallel-safe index names.
Get the Meilisearch host URL.
Clean up all test indexes matching the test prefix.
Wait for all pending Meilisearch tasks to complete.
Details
at line 35
protected void
setUpInteractsWithMeilisearch()
Set up Meilisearch for testing (auto-called by setUpTraits).
Meilisearch integration tests are opt-in via MEILISEARCH_HOST. Port and key settings are only read after MEILISEARCH_HOST is present.
at line 57
protected void
tearDownInteractsWithMeilisearch()
Tear down Meilisearch (auto-called via beforeApplicationDestroyed).
at line 75
protected void
initializeMeilisearchClient()
Initialize the Meilisearch client.
at line 86
protected void
computeMeilisearchTestPrefix()
Compute the test prefix for parallel-safe index names.
at line 99
protected string
getMeilisearchHost()
Get the Meilisearch host URL.
Builds URL from MEILISEARCH_HOST and MEILISEARCH_PORT env vars.
at line 110
protected void
cleanupMeilisearchIndexes()
Clean up all test indexes matching the test prefix.
at line 132
protected void
waitForMeilisearchTasks(int $timeoutMs = 5000)
Wait for all pending Meilisearch tasks to complete.