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 44
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 80
protected void
tearDownInteractsWithAlgolia()
Tear down Algolia (auto-called via beforeApplicationDestroyed).
at line 99
protected HttpClientInterface
createAlgoliaHttpClient()
Create the Algolia HTTP client.
at line 107
protected void
computeAlgoliaTestPrefix()
Compute the test prefix for parallel-safe index names.
at line 118
protected void
cleanupAlgoliaIndices()
Clean up all test indexes matching the test prefix.