4 use BookStack\Repos\EntityRepo;
6 class PageContentTest extends TestCase
9 public function test_page_includes()
11 $page = Page::first();
12 $secondPage = Page::all()->get(2);
14 $secondPage->html = "<p id='section1'>Hello, This is a test</p><p id='section2'>This is a second block of content</p>";
19 $pageContent = $this->get($page->getUrl());
20 $pageContent->assertDontSee('Hello, This is a test');
22 $originalHtml = $page->html;
23 $page->html .= "{{@{$secondPage->id}}}";
26 $pageContent = $this->get($page->getUrl());
27 $pageContent->assertSee('Hello, This is a test');
28 $pageContent->assertSee('This is a second block of content');
30 $page->html = $originalHtml . " Well {{@{$secondPage->id}#section2}}";
33 $pageContent = $this->get($page->getUrl());
34 $pageContent->assertDontSee('Hello, This is a test');
35 $pageContent->assertSee('Well This is a second block of content');
38 public function test_page_revision_views_viewable()
42 $entityRepo = $this->app[EntityRepo::class];
43 $page = Page::first();
44 $entityRepo->updatePage($page, $page->book_id, ['name' => 'updated page', 'html' => '<p>new content</p>', 'summary' => 'page revision testing']);
45 $pageRevision = $page->revisions->last();
47 $revisionView = $this->get($page->getUrl() . '/revisions/' . $pageRevision->id);
48 $revisionView->assertStatus(200);
49 $revisionView->assertSee('new content');
51 $revisionView = $this->get($page->getUrl() . '/revisions/' . $pageRevision->id . '/changes');
52 $revisionView->assertStatus(200);
53 $revisionView->assertSee('new content');