Teste de regressão: diagnóstico do Inertia fechado
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFj5qy3mpHxUj7Q4ap
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user