I'm still not sure why we need this. But this is currently broken when we use a callback as the method does not uses the same arguments and would need to add, at least, the search method in the store since it's being called in the callback (and potentially others methods given to the users by Algolia|Meilisearch clients).
Exemple of callback
// Currently, when running tests, $meilisearch is an instance of ArrayStore
App\Models\User::search('John Doe', function($meilisearch, string $query, array $options) {
$options['sort'] = ['name:asc'];
$options['filter'] = 'email IS NOT NULL';
/** @var Meilisearch\Endpoints\Indexes $meilisearch */
return $meilisearch->search($query, $options);
})->get();
Fix the issue https://github.com/Sti3bas/laravel-scout-array-driver/issues/14
I'm still not sure why we need this. But this is currently broken when we use a callback as the method does not uses the same arguments and would need to add, at least, the
search
method in the store since it's being called in the callback (and potentially others methods given to the users by Algolia|Meilisearch clients).Exemple of callback
See https://github.com/cbaconnier/laravel-scout-array-bug/commit/cdb3620abe1696497cc6cbdb702d64f2dffa4970
~I also mentioned in the issue, as alternative, we could store the callback(s) to allow the users to tests them separately.~
But I haven't got the time to investigate how to adapt the
Store
for this. What do you think?Edit: I don't think we can't add
assertSearchedWithCallback
test since we cannot compare closure. Or at least I have no knowledge of it.