← Code-Übersicht

DokuWriteProtectionTest.php

Pfad: tests/DokuWriteProtectionTest.php

Ext: php

Größe: 652 Bytes

Geändert: 2026-07-16 17:26:37+02

<?php
declare(strict_types=1);

namespace Demo\Tests;

use Demo\Infrastructure\Http\DokuSpeichernAction;
use PHPUnit\Framework\TestCase;
use ReflectionClass;

final class DokuWriteProtectionTest extends TestCase
{
    public function testWebWriteActionIsFailClosed(): void
    {
        $action = (new ReflectionClass(DokuSpeichernAction::class))->newInstanceWithoutConstructor();
        $response = $action(['slug' => 'test']);

        ob_start();
        $response->send();
        $body = ob_get_clean();

        self::assertSame(403, http_response_code());
        self::assertStringContainsString('im Web deaktiviert', (string) $body);
    }
}