runParserTest( '

{{@45#content}}

', ['45' => '

Testing

'], '

Testing

', ); } public function test_simple_inline_text_with_existing_siblings() { $this->runParserTest( '

{{@45#content}} Hithere!

', ['45' => '

Testing

'], '

Testing Hithere!

', ); } public function test_simple_inline_text_within_other_text() { $this->runParserTest( '

Hello {{@45#content}}there!

', ['45' => '

Testing

'], '

Hello Testingthere!

', ); } public function test_block_content_types() { $inputs = [ '
Text
', '', '
  1. Item A
', '
Code
', ]; foreach ($inputs as $input) { $this->runParserTest( '

A{{@45#content}}B

', ['45' => $input], '

A

' . $input . '

B

', ); } } public function test_block_content_nested_origin_gets_placed_before() { $this->runParserTest( '

A {{@45#content}} there!

', ['45' => '
Testing
'], '
Testing

A there!

', ); } public function test_block_content_nested_origin_gets_placed_after() { $this->runParserTest( '

Some really good {{@45#content}} there!

', ['45' => '
Testing
'], '

Some really good there!

Testing
', ); } public function test_block_content_in_shallow_origin_gets_split() { $this->runParserTest( '

Some really good {{@45#content}} there!

', ['45' => '
doggos
'], '

Some really good

doggos

there!

', ); } public function test_block_content_in_shallow_origin_split_does_not_duplicate_id() { $this->runParserTest( '

Some really good {{@45#content}} there!

', ['45' => '
doggos
'], '

Some really good

doggos

there!

', ); } public function test_block_content_in_shallow_origin_does_not_leave_empty_nodes() { $this->runParserTest( '

{{@45#content}}

', ['45' => '
doggos
'], '
doggos
', ); } public function test_simple_whole_document() { $this->runParserTest( '

{{@45}}

', ['45' => '

Testing

'], '

Testing

', ); } public function test_multi_source_elem_whole_document() { $this->runParserTest( '

{{@45}}

', ['45' => '

Testing

This
'], '

Testing

This
', ); } public function test_multi_source_elem_whole_document_with_shared_content_origin() { $this->runParserTest( '

This is {{@45}} some text

', ['45' => '

Testing

This
'], '

This is

Testing

This

some text

', ); } protected function runParserTest(string $html, array $contentById, string $expected) { $parser = new PageIncludeParser($html, function (int $id) use ($contentById) { return $contentById[strval($id)] ?? ''; }); $result = $parser->parse(); $this->assertEquals($expected, $result); } }