#171 Redo the configuration layer to add a ConfigBuilder and group configuration parts
This commit is contained in:
@ -3,6 +3,7 @@ namespace Todaymade\Daux\ContentTypes\Markdown;
|
||||
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use Todaymade\Daux\Config;
|
||||
use Todaymade\Daux\ConfigBuilder;
|
||||
use Todaymade\Daux\Daux;
|
||||
use Todaymade\Daux\DauxHelper;
|
||||
use Todaymade\Daux\Tree\Builder;
|
||||
@ -13,27 +14,7 @@ class LinkRendererTest extends TestCase
|
||||
{
|
||||
protected function getTree(Config $config)
|
||||
{
|
||||
$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->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()
|
||||
@ -70,11 +51,33 @@ class LinkRendererTest extends TestCase
|
||||
*/
|
||||
public function testRenderLink($expected, $string, $current)
|
||||
{
|
||||
$config = new Config();
|
||||
$config['base_url'] = '';
|
||||
$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['tree'] = $this->getTree($config);
|
||||
$config->setCurrentPage(DauxHelper::getFile($config['tree'], $current));
|
||||
$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]);
|
||||
|
||||
|
Reference in New Issue
Block a user