You can use this package to refresh elastic indices (delete the index and make the index again with its corresponding mapping).
Inspired by Laravel RefreshDatabase.
Via Composer
$ composer require majidalaeinia/refresh-elastic --dev
First you need to publish the config file.
php artisan vendor:publish --tag=majidalaeinia-refresh-elastic.config
Fill the config file with appropriate values.
Then, use the RefreshElastic
trait on your test.
<?php
namespace Tests\Feature\FancyTests;
use MajidAlaeinia\RefreshElastic\Traits\RefreshElastic;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class YourFancyTest extends TestCase
{
use RefreshDatabase, RefreshElastic;
}
Important NOTE: Make sure you are using this package on the development mode, because this trait deletes your elastic indices and re-indexes them.
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email alaeinia.majid@gmail.com instead of using the issue tracker.
- Add tests
MIT. Please see the license file for more information.