Skip to content

Commit

Permalink
tests fixed for the raw search result
Browse files Browse the repository at this point in the history
  • Loading branch information
hkulekci committed Sep 4, 2022
1 parent 114f207 commit f51db58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Feature/ElasticSearchEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public function test_pass_empty_response(): void
Artisan::call('scout:import');

$results = Product::search('Quia', static function ($client, $body) {
return $client->search(['index' => 'products', 'body' => $body->toArray()]);
return $client->search(['index' => 'products', 'body' => $body->toArray()])->asArray();
})->raw();

$this->assertIsArray($results);
$this->assertEmpty($results['hits']['hits']);
}

Expand All @@ -39,9 +41,10 @@ public function test_pass_with_response(): void
Artisan::call('scout:import');

$results = Product::search('iphone', static function ($client, $body) {
return $client->search(['index' => 'products', 'body' => $body->toArray()]);
return $client->search(['index' => 'products', 'body' => $body->toArray()])->asArray();
})->raw();

$this->assertIsArray($results);
$this->assertNotEmpty($results['hits']['hits']);
}
}

0 comments on commit f51db58

Please sign in to comment.