25 lines
922 B
PHP
25 lines
922 B
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Guardia di sicurezza: garantisce che la suite giri sul DB di test dedicato
|
|
* (servizio db-test), non sul database di sviluppo `dyncoll`. È volutamente
|
|
* read-only (non usa RefreshDatabase): qui assertiamo che l'host e il nome DB
|
|
* siano quelli di test. La protezione "dura" — che aborta PRIMA di un eventuale
|
|
* migrate:fresh — sta nel guard beforeRefreshingDatabase() di Tests\TestCase.
|
|
*/
|
|
class EnvironmentSafetyTest extends TestCase
|
|
{
|
|
public function test_suite_runs_against_the_dedicated_test_database(): void
|
|
{
|
|
$this->assertSame('testing', app()->environment());
|
|
$this->assertSame('mysql', config('database.default'));
|
|
$this->assertSame('db-test', config('database.connections.mysql.host'));
|
|
$this->assertSame('dyncoll_test', DB::connection()->getDatabaseName());
|
|
}
|
|
}
|