From 7843d8f05427ec80fbac8933072cb2b9bfbc4905 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 6 Feb 2021 13:22:31 +0000 Subject: [PATCH] Added recycle-bin test to cover type deletions --- tests/RecycleBinTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/RecycleBinTest.php b/tests/RecycleBinTest.php index 60f06cfc4..55a9571de 100644 --- a/tests/RecycleBinTest.php +++ b/tests/RecycleBinTest.php @@ -1,7 +1,10 @@ assertNotificationContains('Deleted '.$itemCount.' total items from the recycle bin'); } + public function test_permanent_delete_for_each_type() + { + /** @var Entity $entity */ + foreach ([new Bookshelf, new Book, new Chapter, new Page] as $entity) { + $entity = $entity->newQuery()->first(); + $this->asEditor()->delete($entity->getUrl()); + $deletion = Deletion::query()->orderBy('id', 'desc')->firstOrFail(); + + $deleteReq = $this->asAdmin()->delete("/settings/recycle-bin/{$deletion->id}"); + $deleteReq->assertRedirect('/settings/recycle-bin'); + $this->assertDatabaseMissing('deletions', ['id' => $deletion->id]); + $this->assertDatabaseMissing($entity->getTable(), ['id' => $entity->id]); + } + } + public function test_permanent_entity_delete_updates_existing_activity_with_entity_name() { $page = Page::query()->firstOrFail();