feat: HADO_DEV_USER substitutes X-Remote-User in local env

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
2026-09-04 09:49:32 -03:00
parent cbb43714ae
commit edc08ff43e
5 changed files with 26 additions and 2 deletions

View File

@@ -52,6 +52,21 @@ class MeApiTest extends TestCase
public function test_requires_remote_user_header(): void
{
$this->getJson('/me')->assertStatus(401);
// dev_user срабатывает только в local
config(['hado.dev_user' => 'dev']);
$this->getJson('/me')->assertStatus(401);
}
public function test_dev_user_substitutes_header_in_local_env_only(): void
{
config(['hado.dev_user' => 'dev']);
$this->app->detectEnvironment(fn () => 'local');
$this->getJson('/me')->assertOk()->assertJsonPath('login', 'dev');
config(['hado.dev_user' => '']);
$this->getJson('/me')->assertStatus(401);
}
public function test_first_visit_creates_user_with_web_channel(): void