Link', '[Link](../Widgets/Page_with_#_hash.md)', 'Content/Page.html'], ['Link', '[Link](!Widgets/Page_with_#_hash)', 'Content/Page.html'], ['Link', '[Link](Page_with_#_hash.md)', 'Widgets/Page.html'], // /Widgets/Page ['Link', '[Link](http://google.ch)', 'Widgets/Page.html'], ['Link', '[Link](#features)', 'Widgets/Page.html'], ['Link', '[Link](Button.md)', 'Widgets/Page.html'], ['Link', '[Link](./Button.md)', 'Widgets/Page.html'], ['Link', '[Link](Button)', 'Widgets/Page.html'], ['Link', '[Link](./Button)', 'Widgets/Page.html'], ['Link', '[Link](!Widgets/Button)', 'Widgets/Page.html'], ['Link', '[Link](./Button#Test)', 'Widgets/Page.html'], ['Link', '[Link](!Widgets/Button#Test)', 'Widgets/Page.html'], // /Content/Page ['Link', '[Link](../Widgets/Button.md)', 'Content/Page.html'], ['Link', '[Link](!Widgets/Button)', 'Content/Page.html'], // Mailto links ['me@mydomain.com', '[me@mydomain.com](mailto:me@mydomain.com)', 'Content/Page.html'], ]; } /** * @dataProvider providerRenderLink * * @param mixed $expected * @param mixed $string * @param mixed $current */ public function testRenderLink($expected, $string, $current) { $structure = [ 'Content' => [ 'Page.md' => 'some text content', ], 'Widgets' => [ 'Page.md' => 'another page', 'Button.md' => 'another page', 'Page_with_#_hash.md' => 'page with hash', ], ]; $root = vfsStream::setup('root', null, $structure); $config = ConfigBuilder::withMode() ->withDocumentationDirectory($root->url()) ->withValidContentExtensions(['md']) ->with([ 'base_url' => '', ]) ->build(); $tree = new Root($config); Builder::build($tree, []); $config = ConfigBuilder::withMode()->build(); $config->setTree($tree); $config->setCurrentPage(DauxHelper::getFile($config->getTree(), $current)); $converter = new CommonMarkConverter(['daux' => $config]); $this->assertEquals("

$expected

", trim($converter->convertToHtml($string))); } }