Download the PHP package imdhemy/es-testing-utils without Composer
On this page you can find all versions of the php package imdhemy/es-testing-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download imdhemy/es-testing-utils
More information about imdhemy/es-testing-utils
Files in imdhemy/es-testing-utils
Package es-testing-utils
Short Description Elasticsearch Testing utils
License MIT
Homepage https://github.com/imdhemy/es-testing-utils
Informations about the package es-testing-utils
Elastic search testing utils
Unit tests shouldn't depend on a running cluster, should be mocked out instead. To be more specific, the client responses should be mocked out. Elastic search testing utils makes it super easy for you to mock Elasticsearch responses.
Installation
You can use composer
Versions
Elasticsearch | Es testing Utils |
---|---|
7.x | 7.x |
8.x | 8.x |
Usage
Mocker
Es testing utils provides you a fluent Elasticsearch mock builder, you can use it as follows:
Or you can mock a sequence of responses:
Below is a complete example of how to use EsMocker in a test:
Faker
The faker class provides you a set of methods to generate random data for
your tests. It provides all the methods of the [Faker]() library along with
new methods to generate Elasticsearch data. All the methods related to
Elasticsearch starts with es
prefix.
Credits
License
The ES testing utils is open-sourced software licensed under the MIT license
All versions of es-testing-utils with dependencies
ext-json Version *
elasticsearch/elasticsearch Version ^8.4
fakerphp/faker Version ^1.20