feat: add team editor GET and POST handlers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user