Gate testing API for staging E2E
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-03 15:00:33 +01:00
parent 030a00ba46
commit 7ea34b3b20
17 changed files with 94 additions and 22 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
class TestingApiAccessTest extends TestCase
{
public function test_testing_routes_are_blocked_when_disabled(): void
{
config([
'e2e.testing_enabled' => false,
'e2e.testing_token' => 'secret-token',
]);
$this->withHeader('X-Testing-Token', 'secret-token')
->getJson('/api/_testing/mailbox')
->assertNotFound();
}
public function test_testing_routes_require_token_when_enabled(): void
{
config([
'e2e.testing_enabled' => true,
'e2e.testing_token' => 'secret-token',
]);
$this->getJson('/api/_testing/mailbox')
->assertNotFound();
$this->withHeader('X-Testing-Token', 'secret-token')
->getJson('/api/_testing/mailbox')
->assertOk()
->assertJsonStructure(['data']);
}
}