fix(test): set fulltext search driver to tntsearch

This commit is contained in:
Phan An 2022-07-29 10:26:18 +02:00
parent 3f5d95b0af
commit 2835bfedae
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
3 changed files with 10 additions and 21 deletions

View file

@ -4,7 +4,6 @@ namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
use Throwable;
use Webmozart\Assert\Assert;
class RouteServiceProvider extends ServiceProvider
@ -33,7 +32,6 @@ class RouteServiceProvider extends ServiceProvider
private static function getApiVersion(): ?string
{
try {
// In the test environment, the route service provider is loaded _before_ the request is made,
// so we can't rely on the header.
// Instead, we manually set the API version as an env variable in applicable test cases.
@ -44,8 +42,5 @@ class RouteServiceProvider extends ServiceProvider
}
return $version;
} catch (Throwable) {
return null;
}
}
}

View file

@ -36,7 +36,7 @@
<env name="APP_URL" value="http://localhost/"/>
<env name="APP_KEY" value="16efa6c23c2e8c705826b0e66778fbe7"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SCOUT_DRIVER" value="database"/>
<env name="SCOUT_DRIVER" value="tntsearch"/> <!-- "database" driver doesn't support SQLite -->
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>

View file

@ -6,7 +6,6 @@ use App\Console\Kernel;
use App\Models\User;
use Illuminate\Contracts\Console\Kernel as Artisan;
use Illuminate\Foundation\Application;
use Throwable;
trait CreatesApplication
{
@ -29,12 +28,7 @@ trait CreatesApplication
private function prepareForTests(): void
{
try {
$this->artisan->call('migrate');
} catch (Throwable $e) {
\Log::error($e); // @phpcs:ignore
throw $e;
}
if (!User::count()) {
$this->artisan->call('db:seed');