Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set refresh_documents in phpunit.xml due to strict bool checking #45

Closed
stevebauman opened this issue Aug 4, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@stevebauman
Copy link
Contributor

Software Version
PHP 8.0
Elasticsearch 7.*
Laravel 9.*
Laravel Scout 9.*

Describe the bug
Due to:

$this->refreshDocuments = config('elastic.scout_driver.refresh_documents');

And:

https://github.com/babenkoivan/elastic-adapter/blob/50e9559774c09688a0f5024c964ab22b97c554de/src/Documents/DocumentManager.php#L22

We can't supply a "truthy" value to refresh_documents in our phpunit.xml:

<!-- ... -->
<php>
    <env name="ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS" value="1"/>
    <!-- ... -->
</php>

An exception is thrown:

TypeError: ElasticAdapter\Documents\DocumentManager::index(): Argument #3 ($refresh) must be of type bool, string given

To Reproduce

  1. Publish the configuration file
  2. Add <env name="ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS" value="1"/> to your phpunit.xml
  3. Run a test

Expected behavior
We should cast the value to a boolean before passing it to the DocumentManager.

@stevebauman stevebauman added the bug Something isn't working label Aug 4, 2022
@babenkoivan
Copy link
Owner

Hey @stevebauman, thanks for pointing this out. The issue should be fixed in v3.0.1 🙂

@stevebauman
Copy link
Contributor Author

Excellent, thanks @babenkoivan! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants