feat: assign custom 404 pages with the website theme (1.8.0)
This commit is contained in:
1 parent
a3c89bb69d
commit
16da844934
17 files changed
+638
-92
No files matched your search
@@ -82,6 +82,39 @@ final class EditorSecurityTest extends WebTestCase
|
||||
return $client;
|
||||
}
|
||||
|
||||
public function test404SettingsCreateDraftAndProtectAssignmentFromCsrfAndStaleWrites(): void
|
||||
{
|
||||
$client = $this->login();
|
||||
$crawler = $client->request('GET', '/admin/settings');
|
||||
self::assertSelectorExists('#not-found-picker[role="combobox"]');
|
||||
$form = $crawler->selectButton('404-Vorlage anlegen')->form();
|
||||
$values = $form->getPhpValues();
|
||||
$client->request('POST', '/admin/settings/not-found', [...$values, '_csrf_token' => 'invalid']);
|
||||
self::assertSame(1, (int) $this->db->fetchOne('SELECT COUNT(*) FROM page'));
|
||||
$client->submit($form);
|
||||
self::assertResponseRedirects();
|
||||
$id = json_decode($this->db->fetchOne('SELECT settings FROM website WHERE id = ?', ['default']), true)['notFoundPageId'];
|
||||
self::assertResponseRedirects('/admin/pages/'.$id);
|
||||
self::assertNull($this->db->fetchOne('SELECT published_revision_id FROM page WHERE id = ?', [$id]));
|
||||
$client->request('POST', '/admin/settings/not-found', ['_csrf_token' => $values['_csrf_token'], 'notFoundPageId' => '', 'expectedId' => '']);
|
||||
self::assertSame($id, json_decode($this->db->fetchOne('SELECT settings FROM website WHERE id = ?', ['default']), true)['notFoundPageId']);
|
||||
$client->followRedirect();
|
||||
self::assertSelectorTextContains('body', 'inzwischen geändert');
|
||||
$crawler = $client->request('GET', '/admin/settings');
|
||||
$client->submit($crawler->selectButton('404-Zuordnung speichern')->form(['notFoundPageId' => '']));
|
||||
self::assertSame('', json_decode($this->db->fetchOne('SELECT settings FROM website WHERE id = ?', ['default']), true)['notFoundPageId']);
|
||||
}
|
||||
|
||||
public function test404AssignmentRequiresPublicationRights(): void
|
||||
{
|
||||
$client = $this->login('editor');
|
||||
$client->request('GET', '/admin/settings');
|
||||
self::assertSelectorNotExists('#not-found-form');
|
||||
$client->request('POST', '/admin/settings/not-found', ['action' => 'create']);
|
||||
self::assertResponseStatusCodeSame(403);
|
||||
self::assertSame(1, (int) $this->db->fetchOne('SELECT COUNT(*) FROM page'));
|
||||
}
|
||||
|
||||
public function testEverySharedAreaOpensPreviewsAndSavesWithConflictProtection(): void
|
||||
{
|
||||
$client = $this->login();
|
||||
|
||||
Reference in new issue
Block a user