InteractsWithAlgolia
trait InteractsWithAlgolia
Add Algolia support to an integration test.
Use this trait on a test case and set ALGOLIA_APP_ID and ALGOLIA_SECRET. Test indexes are isolated and cleaned up using a TEST_TOKEN-based prefix.
Properties
| protected string | $algoliaTestPrefix | The test prefix for index isolation. |
|
| protected SearchClient|null | $algolia | The Algolia client instance. |
|
| protected HttpClientInterface|null | $previousAlgoliaHttpClient | The HTTP client installed before this test. |
Methods
Set up Algolia for testing (auto-called by setUpTraits).
Tear down Algolia (auto-called via beforeApplicationDestroyed).
Create the Algolia HTTP client.
Compute the test prefix for parallel-safe index names.
Clean up all test indexes matching the test prefix.
Details
at line 46
protected void
setUpInteractsWithAlgolia()
Set up Algolia for testing (auto-called by setUpTraits).
Algolia integration tests are opt-in via ALGOLIA_APP_ID and ALGOLIA_SECRET. If credentials are set but the probe fails, the exception propagates so the test fails loudly.
at line 82
protected void
tearDownInteractsWithAlgolia()
Tear down Algolia (auto-called via beforeApplicationDestroyed).
at line 105
protected HttpClientInterface
createAlgoliaHttpClient()
Create the Algolia HTTP client.
at line 113
protected void
computeAlgoliaTestPrefix()
Compute the test prefix for parallel-safe index names.
at line 126
protected void
cleanupAlgoliaIndices()
Clean up all test indexes matching the test prefix.
Every scheduled deletion is awaited before the first incomplete task is reported.