Fassung 1.7.0: verlässliche Installation, übersichtliche Verwaltung und bedienbare Bewegung
CMS quality / php (8.2) (push) Canceled after 0s
CMS quality / php (8.4) (push) Canceled after 0s
CMS quality / browser (push) Canceled after 0s
CMS quality / mysql (push) Canceled after 0s

This commit is contained in:
kantarci committed 2026-09-14 10:49:54 +02:00
1 parent b164c4edfe
commit 495b26896e
55 files changed
+1632 -423

No files matched your search

+28
View File
@@ -82,6 +82,34 @@ final class EditorSecurityTest extends WebTestCase
return $client;
}
public function testEverySharedAreaOpensPreviewsAndSavesWithConflictProtection(): void
{
$client = $this->login();
$partials = new PartialRepository($this->db, new DocumentValidator());
$partials->create('section', 'shared-test', 'Gemeinsamer Abschnitt', DemoContent::areas()['footer']['document']);
foreach ($partials->all() as $partial) {
$base = '/admin/partials/'.$partial['id'];
$client->request('GET', $base);
self::assertResponseIsSuccessful();
self::assertSelectorExists('#editor[data-api="'.$base.'"]');
self::assertSelectorNotExists('#publish');
$client->request('GET', $base.'/document');
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$document = $data['document'];
$document['title'] .= ' bearbeitet';
$headers = ['CONTENT_TYPE' => 'application/json', 'HTTP_X_CSRF_TOKEN' => $data['csrfToken']];
$body = json_encode(['document' => $document, 'expectedVersion' => $data['version']], JSON_THROW_ON_ERROR);
$client->request('POST', $base.'/preview', server: $headers, content: $body);
self::assertResponseIsSuccessful();
$client->request('POST', $base.'/draft', server: $headers, content: $body);
self::assertResponseIsSuccessful();
$client->request('POST', $base.'/draft', server: $headers, content: $body);
self::assertResponseStatusCodeSame(409);
$client->request('GET', $base.'/document');
self::assertSame($document['title'], json_decode($client->getResponse()->getContent(), true)['document']['title']);
}
}
private function data(KernelBrowser $client): array
{
$client->request('GET', '/admin/api/pages/p1');