. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Factories; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\Tree; /** * Test harness for the class MarkdownFactory * * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ class MarkdownFactoryTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithoutTree(): void { $factory = new MarkdownFactory(); static::assertSame( "FOO https://example.com BAR", $factory->autolink('FOO https://example.com BAR') ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithTree(): void { $factory = new MarkdownFactory(); $tree = $this->createStub(Tree::class); static::assertSame( "FOO https://example.com BAR", $factory->autolink('FOO https://example.com BAR', $tree) ); } /** * @covers \Fisharebest\Webtrees\CommonMark\XrefExtension * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testAutoLinkWithHtml(): void { $factory = new MarkdownFactory(); static::assertSame( "<b> https://example.com </b>", $factory->autolink(' https://example.com ') ); } /** * @covers \Fisharebest\Webtrees\Factories\MarkdownFactory */ public function testMarkdownWithoutTree(): void { $factory = new MarkdownFactory(); static::assertSame( "
FOO https://example.com BAR
\n", $factory->markdown('FOO https://example.com BAR') ); static::assertSame( "FOO https://example.com BAR
\n", $factory->markdown('FOOFOO https://example.com BAR
\n", $factory->markdown('FOO https://example.com BAR', $tree) ); static::assertSame( "FOO https://example.com BAR
\n", $factory->markdown('FOO<b> https://example.com </b>
\n", $factory->markdown('alpha
beta
gamma
\ndelta
alpha
beta
gamma
delta