feat: add team editor GET and POST handlers

This commit is contained in:
Keith Solomon
2026-07-06 21:54:59 -05:00
parent 6a0b147e4e
commit 12b1547fac
4 changed files with 251 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace BattleForge\Tests\Integration;
use BattleForge\Http\Handlers\GetTeamEditor;
use BattleForge\Http\Request;
use PHPUnit\Framework\TestCase;
final class GetTeamEditorTest extends TestCase
{
public function testItReturnsTheTeamEditorPageWithSecurityHeaders(): void
{
$handler = new GetTeamEditor();
$request = new Request([], [], [], [], [], '', 'GET', '/scenarios/demo/edit/team', 'text/html', '');
$response = $handler->handle($request, ['id' => 'demo']);
self::assertSame(200, $response->status);
self::assertStringContainsString('text/html', $response->headers['Content-Type'] ?? '');
self::assertSame('nosniff', $response->headers['X-Content-Type-Options']);
self::assertStringContainsString('default-src', $response->headers['Content-Security-Policy']);
self::assertStringContainsString('name="_csrf"', $response->body);
self::assertStringContainsString('name="id"', $response->body);
self::assertStringContainsString('name="victoryCondition"', $response->body);
self::assertStringContainsString('value="defender"', $response->body);
}
}