. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Factories; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\Tree; /** * Test harness for the class GedcomEditService * * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ class MarkdownFactoryTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithoutTree(): void { $factory = new MarkdownFactory(); $autolink = $factory->autolink(); $this->assertSame( "

FOO https://example.com BAR

\n", $autolink->convertToHtml('FOO https://example.com BAR') ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithTree(): void { $tree = $this->createStub(Tree::class); $factory = new MarkdownFactory(); $autolink = $factory->autolink($tree); $this->assertSame( "

FOO https://example.com BAR

\n", $autolink->convertToHtml('FOO https://example.com BAR') ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithHtml(): void { $factory = new MarkdownFactory(); $autolink = $factory->autolink(); $this->assertSame( "

<b> https://example.com </b>

\n", $autolink->convertToHtml(' https://example.com ') ); } /** * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testMarkdownWithoutTree(): void { $factory = new MarkdownFactory(); $Markdown = $factory->Markdown(); $this->assertSame( "

FOO https://example.com BAR

\n", $Markdown->convertToHtml('FOO https://example.com BAR') ); $this->assertSame( "

FOO https://example.com BAR

\n", $Markdown->convertToHtml('FOO BAR') ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testMarkdownWithTree(): void { $tree = $this->createStub(Tree::class); $factory = new MarkdownFactory(); $Markdown = $factory->Markdown($tree); $this->assertSame( "

FOO https://example.com BAR

\n", $Markdown->convertToHtml('FOO https://example.com BAR') ); $this->assertSame( "

FOO https://example.com BAR

\n", $Markdown->convertToHtml('FOO BAR') ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testMarkdownWithHtml(): void { $factory = new MarkdownFactory(); $markdown = $factory->Markdown(); $this->assertSame( "

<b> https://example.com </b>

\n", $markdown->convertToHtml(' ') ); } }