BookStack/tests/Entity/PageTest.php
Dan Brown ef1b98019a
Fixed some mis-refactoring and split search service
Search service broken into index and runner tools.
2020-11-22 00:17:45 +00:00

27 lines
905 B
PHP

<?php namespace Tests\Entity;
use BookStack\Entities\Models\Page;
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');
}
}