Skip to content

Searching in tests with customized options #899

Open
@mrozbarry

Description

@mrozbarry

Scout Version

10.11.8

Scout Driver

Typesense

Laravel Version

10.48.25

PHP Version

8.2.0

Database Driver & Version

No response

SDK Version

No response

Meilisearch CLI Version

No response

Description

For tests, we would like to use the collection driver, but we're passing custom options for typesense that (reasonably so) the collection driver doesn't support.

What we would sort of like to see is something like Scout::assertWasSearched(Model::class, [...$options]) so we can abstract the service we're using and really just assert that we at least did the search we expected.

I suspect some of the wisdom for this not being supported would say to just use typesense in searches, but I am curious if what I'm asking for is reasonable and possible, and if so, I'd be more than happy to make a PR.

Steps To Reproduce

Create a test that uses Model::search('')->options(['filter_by' => 'created:[0..9999]']) and see that the collection driver has no concept of the filter_by key that typesense uses.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions