fix: complete InvesteMoz validation and error corrections
This commit is contained in:
+20
-5
@@ -2,10 +2,15 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use App\Support\IsolatedQaDatabase;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabaseState;
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
use Illuminate\Foundation\Vite;
|
||||
use Laravel\Fortify\Features;
|
||||
use Tests\InvestMoz\SchemaLifecycleTest;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
@@ -48,12 +53,13 @@ abstract class TestCase extends BaseTestCase
|
||||
}
|
||||
|
||||
// migrate:fresh only clears the connection's public search path. This module owns a separate schema.
|
||||
if (! RefreshDatabaseState::$migrated && $app->environment('testing')) {
|
||||
$traits = class_uses_recursive(static::class);
|
||||
$rebuildsDatabase = isset($traits[RefreshDatabase::class])
|
||||
|| isset($traits[DatabaseMigrations::class])
|
||||
|| $this instanceof SchemaLifecycleTest;
|
||||
if ($rebuildsDatabase && ! RefreshDatabaseState::$migrated && $app->environment('testing')) {
|
||||
$db = $app->make('db')->connection();
|
||||
if ($db->getDriverName() === 'pgsql'
|
||||
&& in_array($db->getDatabaseName(), ['portal_services_test', 'investmoz_test', 'investmoz_browser_e2e_test', 'investmoz_guidance_20261008_test', 'investmoz_v2_20261008_test'], true)
|
||||
&& (string) $db->getConfig('port') === '55441'
|
||||
&& in_array($db->getConfig('host'), ['127.0.0.1', 'localhost'], true)) {
|
||||
if (IsolatedQaDatabase::allowsSchemaChanges()) {
|
||||
$db->statement('DROP SCHEMA IF EXISTS skills_edu CASCADE');
|
||||
if ($db->selectOne("SELECT to_regclass('public.complementary_project_links') AS id")->id !== null) {
|
||||
$db->statement('DROP TRIGGER IF EXISTS project_dependency_check ON public.complementary_project_links');
|
||||
@@ -78,6 +84,15 @@ abstract class TestCase extends BaseTestCase
|
||||
config(['inertia.ssr.enabled' => false]);
|
||||
}
|
||||
|
||||
protected function withoutVite()
|
||||
{
|
||||
parent::withoutVite();
|
||||
// Laravel's asset fake leaves font loading active. HTTP tests must not read mutable build assets.
|
||||
$this->app->make(Vite::class)->useFontsManifestFilename('__phpunit_fonts_disabled__.json');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function skipUnlessFortifyHas(string $feature, ?string $message = null): void
|
||||
{
|
||||
if (! Features::enabled($feature)) {
|
||||
|
||||
Reference in New Issue
Block a user