mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-31 04:55:50 +08:00
Added transclusion tests and fixed other tests
This commit is contained in:
33
tests/Entity/PageContentTest.php
Normal file
33
tests/Entity/PageContentTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class PageContentTest extends TestCase
|
||||
{
|
||||
|
||||
public function test_page_includes()
|
||||
{
|
||||
$page = \BookStack\Page::first();
|
||||
$secondPage = \BookStack\Page::all()->get(2);
|
||||
|
||||
$secondPage->html = "<p id='section1'>Hello, This is a test</p><p id='section2'>This is a second block of content</p>";
|
||||
$secondPage->save();
|
||||
|
||||
$this->asAdmin()->visit($page->getUrl())
|
||||
->dontSee('Hello, This is a test');
|
||||
|
||||
$originalHtml = $page->html;
|
||||
$page->html .= "{{@{$secondPage->id}}}";
|
||||
$page->save();
|
||||
|
||||
$this->asAdmin()->visit($page->getUrl())
|
||||
->see('Hello, This is a test')
|
||||
->see('This is a second block of content');
|
||||
|
||||
$page->html = $originalHtml . " Well {{@{$secondPage->id}#section2}}";
|
||||
$page->save();
|
||||
|
||||
$this->asAdmin()->visit($page->getUrl())
|
||||
->dontSee('Hello, This is a test')
|
||||
->see('Well This is a second block of content');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user