1
0
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:
Dan Brown
2023-11-27 19:54:47 +00:00
parent 4874dc1304
commit 71c93c8878
7 changed files with 60 additions and 148 deletions

View File

@@ -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());
}
}