X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/dabe79a438f22612e7d68c8d1de7817505b59b93..refs/pull/2023/head:/tests/Entity/EntityTest.php diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.php index 97684ea4d..d7e4ec61c 100644 --- a/tests/Entity/EntityTest.php +++ b/tests/Entity/EntityTest.php @@ -1,4 +1,4 @@ -seePageIs($chapter->getUrl()); } + public function test_page_delete_removes_entity_from_its_activity() + { + $page = Page::query()->first(); + + $this->asEditor()->put($page->getUrl(), [ + 'name' => 'My updated page', + 'html' => '

updated content

', + ]); + $page->refresh(); + + $this->seeInDatabase('activities', [ + 'entity_id' => $page->id, + 'entity_type' => $page->getMorphClass(), + ]); + + $resp = $this->delete($page->getUrl()); + $resp->assertResponseStatus(302); + + $this->dontSeeInDatabase('activities', [ + 'entity_id' => $page->id, + 'entity_type' => $page->getMorphClass(), + ]); + + $this->seeInDatabase('activities', [ + 'extra' => 'My updated page', + 'entity_id' => 0, + 'entity_type' => '', + ]); + } + }