mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-06 12:02:45 +03:00
Includes: Switched page to new system
- Added mulit-level depth parsing. - Updating usage of HTML doc in page content to be efficient. - Removed now redundant PageContentTest cases. - Made some include system fixes based upon testing.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Unit;
|
||||
|
||||
use BookStack\Entities\Tools\PageIncludeParser;
|
||||
use BookStack\Util\HtmlDocument;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PageIncludeParserTest extends TestCase
|
||||
@@ -214,13 +215,14 @@ class PageIncludeParserTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
protected function runParserTest(string $html, array $contentById, string $expected)
|
||||
protected function runParserTest(string $html, array $contentById, string $expected): void
|
||||
{
|
||||
$parser = new PageIncludeParser($html, function (int $id) use ($contentById) {
|
||||
$doc = new HtmlDocument($html);
|
||||
$parser = new PageIncludeParser($doc, function (int $id) use ($contentById) {
|
||||
return $contentById[strval($id)] ?? '';
|
||||
});
|
||||
|
||||
$result = $parser->parse();
|
||||
$this->assertEquals($expected, $result);
|
||||
$parser->parse();
|
||||
$this->assertEquals($expected, $doc->getBodyInnerHtml());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user