diff --git a/libs/Tree/Builder.php b/libs/Tree/Builder.php index 50b77c2..2defa09 100644 --- a/libs/Tree/Builder.php +++ b/libs/Tree/Builder.php @@ -99,7 +99,7 @@ class Builder $config = $parent->getConfig(); if (!in_array($file->getExtension(), $config['valid_content_extensions'])) { - $uri = static::removeSortingInformations($file->getFilename()); + $uri = $file->getFilename(); $entry = new Raw($parent, $uri, $file); $entry->setTitle(str_replace('_', ' ', static::removeSortingInformations($name))); diff --git a/tests/Tree/BuilderTest.php b/tests/Tree/BuilderTest.php index 0072f79..a034df5 100644 --- a/tests/Tree/BuilderTest.php +++ b/tests/Tree/BuilderTest.php @@ -1,6 +1,7 @@ setDocumentationDirectory(''); $root = new Root($config); - $dir = Builder::getOrCreateDir($root, 'directory'); $this->assertSame($root, $dir->getParent()); @@ -147,4 +147,28 @@ class BuilderTest extends TestCase $this->assertEquals('file.json', $entry->getUri()); $this->assertInstanceOf('Todaymade\Daux\Tree\ComputedRaw', $entry); } + + public function testScanner() + { + $structure = [ + 'Page.md' => 'another page', + 'Button.md' => 'another page', + '22.png' => '' + ]; + $root = vfsStream::setup('root', null, $structure); + + $config = new Config; + $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, []); + + $this->assertEquals( + ['22.png', 'Button.html', 'Page.html'], + array_keys($tree->getEntries()) + ); + } }