Files
Investidor-V2/tests/Feature/InertiaDevtoolsClosedTest.php
T

39 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Route;
use Inertia\DevTools\DevTools;
use Tests\TestCase;
/**
* C132: as rotas de diagnóstico do Inertia (/_inertia/devtools) já responderam
* 200 a pedidos anónimos com APP_ENV=local. A configuração explícita
* `inertia.devtools.enabled = false` fecha-as; este teste impede a regressão.
*/
final class InertiaDevtoolsClosedTest extends TestCase
{
use RefreshDatabase;
public function test_devtools_are_explicitly_disabled_and_do_not_register_routes(): void
{
$this->assertFalse(config('inertia.devtools.enabled'));
$this->assertFalse(DevTools::enabled());
$registered = collect(Route::getRoutes())->contains(fn ($route) => str_starts_with($route->uri(), '_inertia/devtools'));
$this->assertFalse($registered, 'As rotas de diagnóstico do Inertia não podem estar registadas.');
}
public function test_anonymous_requests_to_devtools_entries_are_not_found(): void
{
$this->getJson('/_inertia/devtools/entries')->assertNotFound();
$this->getJson('/_inertia/devtools/entries/qualquer-id')->assertNotFound();
}
public function test_the_explicit_setting_still_wins_in_a_local_environment(): void
{
$this->app['env'] = 'local';
$this->assertFalse(DevTools::enabled());
}
}