Skip to content
This repository was archived by the owner on May 13, 2021. It is now read-only.

Commit 995e001

Browse files
build(deps): update meilisearch/meilisearch-php requirement from ^0.11 to ^0.11 || ^0.12 (#33)
* build(deps): update meilisearch/meilisearch-php requirement || ^0.12 Updates the requirements on meilisearch/meilisearch-php to permit the latest version. Signed-off-by: dependabot-preview[bot] <[email protected]> * return the correct mock instance The v0.12 has been refactored and now Indexes is returned instead of StdClass * Update composer.json Only tests are broken between v0.11 and v0.12, but I think it's better that way. Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jordan Massart <[email protected]>
1 parent 4b88b19 commit 995e001

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"require": {
1414
"php": "^7.2.5",
1515
"laravel/scout": "^8.0",
16-
"meilisearch/meilisearch-php": "^0.11"
16+
"meilisearch/meilisearch-php": "^0.12"
1717
},
1818
"require-dev": {
1919
"orchestra/testbench": "^5.0",

tests/MeilisearchEngineTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Meilisearch\Scout\Tests;
44

5+
use MeiliSearch\Endpoints\Indexes;
56
use stdClass;
67
use Mockery as m;
78
use MeiliSearch\Client;
@@ -21,7 +22,7 @@ protected function tearDown(): void
2122
public function update_adds_objects_to_index()
2223
{
2324
$client = m::mock(Client::class);
24-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
25+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
2526
$index->shouldReceive('addDocuments')->with([
2627
[
2728
'id' => 1,
@@ -36,7 +37,7 @@ public function update_adds_objects_to_index()
3637
public function delete_removes_objects_to_index()
3738
{
3839
$client = m::mock(Client::class);
39-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
40+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
4041
$index->shouldReceive('deleteDocuments')->with([1]);
4142

4243
$engine = new MeilisearchEngine($client);
@@ -47,7 +48,7 @@ public function delete_removes_objects_to_index()
4748
public function search_sends_correct_parameters_to_meilisearch()
4849
{
4950
$client = m::mock(Client::class);
50-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
51+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
5152
$index->shouldReceive('search')->with('mustang', [
5253
'filters' => 'foo=1',
5354
]);
@@ -133,7 +134,7 @@ public function map_method_respects_order()
133134
public function a_model_is_indexed_with_a_custom_meilisearch_key()
134135
{
135136
$client = m::mock(Client::class);
136-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
137+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
137138
$index->shouldReceive('addDocuments')->with([['id' => 'my-meilisearch-key.1']]);
138139

139140
$engine = new MeilisearchEngine($client);
@@ -144,7 +145,7 @@ public function a_model_is_indexed_with_a_custom_meilisearch_key()
144145
public function flush_a_model_with_a_custom_meilisearch_key()
145146
{
146147
$client = m::mock(Client::class);
147-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
148+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
148149
$index->shouldReceive('deleteAllDocuments');
149150

150151
$engine = new MeilisearchEngine($client);
@@ -155,7 +156,7 @@ public function flush_a_model_with_a_custom_meilisearch_key()
155156
public function update_empty_searchable_array_does_not_add_objects_to_index()
156157
{
157158
$client = m::mock(Client::class);
158-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
159+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
159160
$index->shouldNotReceive('addObjects');
160161

161162
$engine = new MeilisearchEngine($client);
@@ -169,7 +170,7 @@ public function pagination_correct_parameters()
169170
$page = 2;
170171

171172
$client = m::mock(Client::class);
172-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
173+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
173174
$index->shouldReceive('search')->with('mustang', [
174175
'filters' => 'foo=1',
175176
'limit' => $perPage,
@@ -205,7 +206,7 @@ public function toSearchableArray()
205206
public function update_empty_searchable_array_from_soft_deleted_model_does_not_add_objects_to_index()
206207
{
207208
$client = m::mock(Client::class);
208-
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(stdClass::class));
209+
$client->shouldReceive('getIndex')->with('table')->andReturn($index = m::mock(Indexes::class));
209210
$index->shouldNotReceive('addDocuments');
210211

211212
$engine = new MeilisearchEngine($client, true);

0 commit comments

Comments
 (0)