elastic-scout-driver
elastic-scout-driver copied to clipboard
Unable to set `refresh_documents` in `phpunit.xml` due to strict bool checking
| Software | Version |
|---|---|
| PHP | 8.0 |
| Elasticsearch | 7.* |
| Laravel | 9.* |
| Laravel Scout | 9.* |
Describe the bug Due to:
https://github.com/babenkoivan/elastic-scout-driver/blob/9b15115c886c2fada0be9e14b92d70c6ec7bbcc3/src/Engine.php#L38
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
- Publish the configuration file
- Add
<env name="ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS" value="1"/>to yourphpunit.xml - Run a test
Expected behavior
We should cast the value to a boolean before passing it to the DocumentManager.