2020-11-06 07:54:39 -05:00
|
|
|
<?php namespace Tests\Entity;
|
|
|
|
|
2020-11-21 19:17:45 -05:00
|
|
|
use BookStack\Entities\Models\Page;
|
2020-11-06 07:54:39 -05:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class PageTest extends TestCase
|
|
|
|
{
|
|
|
|
public function test_page_delete()
|
|
|
|
{
|
|
|
|
$page = Page::query()->first();
|
|
|
|
$this->assertNull($page->deleted_at);
|
|
|
|
|
|
|
|
$deleteViewReq = $this->asEditor()->get($page->getUrl('/delete'));
|
|
|
|
$deleteViewReq->assertSeeText('Are you sure you want to delete this page?');
|
|
|
|
|
|
|
|
$deleteReq = $this->delete($page->getUrl());
|
|
|
|
$deleteReq->assertRedirect($page->getParent()->getUrl());
|
|
|
|
$this->assertActivityExists('page_delete', $page);
|
|
|
|
|
|
|
|
$page->refresh();
|
|
|
|
$this->assertNotNull($page->deleted_at);
|
|
|
|
$this->assertTrue($page->deletions()->count() === 1);
|
|
|
|
|
|
|
|
$redirectReq = $this->get($deleteReq->baseResponse->headers->get('location'));
|
|
|
|
$redirectReq->assertNotificationContains('Page Successfully Deleted');
|
|
|
|
}
|
|
|
|
}
|