1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added deletion of revisions on page delete

Added testing to cover.
Closes #2668
This commit is contained in:
Dan Brown
2021-05-26 16:40:56 +01:00
parent d326417edc
commit eb76e882c5
3 changed files with 43 additions and 3 deletions

View File

@ -71,6 +71,33 @@ class PageTest extends TestCase
$redirectReq->assertNotificationContains('Page Successfully Deleted');
}
public function test_page_full_delete_removes_all_revisions()
{
/** @var Page $page */
$page = Page::query()->first();
$page->revisions()->create([
'html' => '<p>ducks</p>',
'name' => 'my page revision',
'type' => 'draft',
]);
$page->revisions()->create([
'html' => '<p>ducks</p>',
'name' => 'my page revision',
'type' => 'revision',
]);
$this->assertDatabaseHas('page_revisions', [
'page_id' => $page->id,
]);
$this->asEditor()->delete($page->getUrl());
$this->asAdmin()->post('/settings/recycle-bin/empty');
$this->assertDatabaseMissing('page_revisions', [
'page_id' => $page->id,
]);
}
public function test_page_copy()
{
$page = Page::first();