[ '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->setDocumentationDirectory($root->url()); $config['valid_content_extensions'] = ['md']; $config['mode'] = Daux::STATIC_MODE; $config['index_key'] = 'index.html'; $tree = new Root($config); Builder::build($tree, []); return $tree; } public function providerRenderLink() { return [ // /Widgets/Page_with_#_hash ['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 */ public function testRenderLink($expected, $string, $current) { $config = new Config(); $config['base_url'] = ''; $config['tree'] = $this->getTree($config); $config->setCurrentPage(DauxHelper::getFile($config['tree'], $current)); $converter = new CommonMarkConverter(['daux' => $config]); $this->assertEquals("

$expected

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