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.
Wait for a Meilisearch task to complete successfully.
Details
at line 36
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 58
protected void
tearDownInteractsWithMeilisearch()
Tear down Meilisearch (auto-called via beforeApplicationDestroyed).
at line 76
protected void
initializeMeilisearchClient()
Initialize the Meilisearch client.
at line 87
protected void
computeMeilisearchTestPrefix()
Compute the test prefix for parallel-safe index names.
at line 100
protected string
getMeilisearchHost()
Get the Meilisearch host URL.
Builds URL from MEILISEARCH_HOST and MEILISEARCH_PORT env vars.
at line 111
protected void
cleanupMeilisearchIndexes()
Clean up all test indexes matching the test prefix.
at line 138
protected void
waitForMeilisearchTasks(int $timeoutMs = 5000)
Wait for all pending Meilisearch tasks to complete.
at line 163
protected void
waitForMeilisearchTask(int $taskUid, int $timeoutMs = 5000)
Wait for a Meilisearch task to complete successfully.