mirror of
https://github.com/koel/koel
synced 2024-11-24 05:03:05 +00:00
fix(test): set fulltext search driver to tntsearch
This commit is contained in:
parent
3f5d95b0af
commit
2835bfedae
3 changed files with 10 additions and 21 deletions
|
@ -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,19 +32,15 @@ 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.
|
||||
$version = app()->runningUnitTests() ? env('X_API_VERSION') : request()->header('X-Api-Version');
|
||||
// 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.
|
||||
$version = app()->runningUnitTests() ? env('X_API_VERSION') : request()->header('X-Api-Version');
|
||||
|
||||
if ($version) {
|
||||
Assert::oneOf($version, ['v6']);
|
||||
}
|
||||
|
||||
return $version;
|
||||
} catch (Throwable) {
|
||||
return null;
|
||||
if ($version) {
|
||||
Assert::oneOf($version, ['v6']);
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
$this->artisan->call('migrate');
|
||||
|
||||
if (!User::count()) {
|
||||
$this->artisan->call('db:seed');
|
||||
|
|
Loading…
Reference in a new issue