🆙 Added fixed cms

This commit is contained in:
Remco
2026-01-07 19:32:43 +01:00
parent fdb0dc276d
commit 711fa2c29e
3992 changed files with 183381 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace Tests;
use Database\Seeders\TestingSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\DB;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication, RefreshDatabase;
protected function refreshTestDatabase()
{
if (! RefreshDatabase::$migrated) {
// Create database if it doesn't exist
$this->createTestDatabase();
// Run migrations (including CoreSqlFile migration)
$this->artisan('migrate:fresh');
// Force TestingSeeder to run
$this->artisan('db:seed', ['--class' => TestingSeeder::class]);
RefreshDatabase::$migrated = true;
}
$this->beginDatabaseTransaction();
}
protected function createTestDatabase(): void
{
$database = config('database.connections.mariadb.database');
$connection = config('database.connections.mariadb');
// Connect to MariaDB without specifying database
$tempConnection = [
'driver' => 'mysql',
'host' => $connection['host'],
'port' => $connection['port'],
'username' => $connection['username'],
'password' => $connection['password'],
];
config(['database.connections.temp' => $tempConnection]);
DB::connection('temp')->statement("CREATE DATABASE IF NOT EXISTS `{$database}`");
DB::purge('temp');
}
}