Testing: Added extra page edit test

Added during investigation for #6062
Might as well leave in even though it does not trigger the cause for
that particuluar issue.
This commit is contained in:
Dan Brown
2026-05-18 17:39:00 +01:00
parent 0cd773a5d3
commit b5d3ba2726

View File

@@ -273,4 +273,29 @@ class PageTest extends TestCase
$resp->assertSessionHas('error', 'You do not have permission to access the requested page.');
}
public function test_page_html_content_remains_stable_through_re_edit_and_does_not_create_revision()
{
$page = $this->entities->page();
$this->asEditor()->put($page->getUrl(), [
'name' => 'Stability Test',
'html' => '<table border="1" style="border-collapse: collapse; width: 100%;" border="1"><tbody><tr><td>a</td></tr></tbody></table>',
]);
$initialRevisionCount = $page->revisions()->count();
$page->refresh();
// Get the page content from the edit view to ensure we're using the
// exact same content which would be loaded into the editor.
$editView = $this->get($page->getUrl('/edit'));
$htmlContentEncoded = $this->withHtml($editView)->getInnerHtml('textarea#html-editor');
$htmlContent = html_entity_decode($htmlContentEncoded);
$this->asEditor()->put($page->getUrl(), [
'name' => 'Stability Test',
'html' => $htmlContent,
]);
$this->assertEquals($initialRevisionCount, $page->revisions()->count());
}
}