Skip to content

Commit

Permalink
Fix missing variable in closure (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Jan 9, 2023
1 parent 12ff8b6 commit 1f5913e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"require-dev": {
"meilisearch/meilisearch-php": "^0.19",
"mockery/mockery": "^1.0",
"php-http/guzzle7-adapter": "^1.0",
"orchestra/testbench": "^6.17|^7.0",
"phpunit/phpunit": "^9.3"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ScoutServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function register()
$meilisearchClientClassName = class_exists(MeiliSearchClient::class)
? MeiliSearchClient::class
: \Meilisearch\Client::class;
$this->app->singleton($meilisearchClientClassName, function ($app) {
$this->app->singleton($meilisearchClientClassName, function ($app) use ($meilisearchClientClassName) {
$config = $app['config']->get('scout.meilisearch');

$meilisearchVersionClassName = class_exists(MeiliSearch::class)
Expand Down
25 changes: 25 additions & 0 deletions tests/Feature/MeilisearchEngineTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Laravel\Scout\Tests\Feature;

use Laravel\Scout\ScoutServiceProvider;
use MeiliSearch\Client;
use Orchestra\Testbench\TestCase;

class MeilisearchEngineTest extends TestCase
{
protected function getPackageProviders($app)
{
return [ScoutServiceProvider::class];
}

protected function defineEnvironment($app)
{
$app->make('config')->set('scout.driver', 'meilisearch');
}

public function test_the_meilisearch_client_can_be_initialized()
{
$this->assertInstanceOf(Client::class, app(Client::class));
}
}

0 comments on commit 1f5913e

Please sign in to comment.