Update tests

This commit is contained in:
2026-08-04 21:00:01 +02:00
parent 9dcf13a62e
commit 71d679cc5e
18 changed files with 822 additions and 426 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\RefreshDatabase as BaseRefreshDatabase;
use Illuminate\Support\Facades\DB;
/**
* RefreshDatabase variant that provisions the test database from the committed
* MySQL/MariaDB schema dump (database/schema/mysql-schema.sql) instead of
* running the app's incomplete / data-dependent migrations.
*
* Refresh the dump after schema changes with: php artisan schema:dump
*/
trait RefreshDatabase
{
use BaseRefreshDatabase;
/**
* Import the committed schema dump. It is idempotent: it drops and
* recreates every table, so it also works when the test database already
* exists from a previous run.
*/
protected function migrateDatabases()
{
DB::unprepared(
file_get_contents(database_path('schema/mysql-schema.sql'))
);
}
}