. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Factories; use Fisharebest\Webtrees\CommonMark\XrefExtension; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\Tree; use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(MarkdownFactory::class)] #[CoversClass(XrefExtension::class)] class MarkdownFactoryTest extends TestCase { public function testAutoLinkWithoutTree(): void { $factory = new MarkdownFactory(); static::assertSame( '
FOO https://example.com BAR
', $factory->autolink('FOO https://example.com BAR') ); } public function testAutoLinkWithTree(): void { $factory = new MarkdownFactory(); $tree = $this->createMock(Tree::class); static::assertSame( 'FOO https://example.com BAR
', $factory->autolink('FOO https://example.com BAR', $tree) ); } public function testAutoLinkWithHtml(): void { $factory = new MarkdownFactory(); static::assertSame( '<b> https://example.com </b>
', $factory->autolink(' https://example.com ') ); } public function testMarkdownWithoutTree(): void { $factory = new MarkdownFactory(); static::assertSame( 'FOO https://example.com BAR
', $factory->markdown('FOO https://example.com BAR') ); static::assertSame( 'FOO https://example.com BAR
', $factory->markdown('FOOFOO https://example.com BAR
', $factory->markdown('FOO https://example.com BAR', $tree) ); static::assertSame( 'FOO https://example.com BAR
', $factory->markdown('FOO<b> https://example.com </b>
', $factory->markdown('alpha
beta
gamma
delta
alpha
beta
gamma
delta
alpha
beta
gamma
delta
alpha
beta
gamma
delta