Keep numbers in raw files, as they aren't sorted anyway. Fixes #26

This commit is contained in:
Stéphane Goetz 2018-06-05 21:28:54 +02:00
bovenliggende 41c355edb1
commit eb89664473
2 gewijzigde bestanden met toevoegingen van 26 en 2 verwijderingen

Bestand weergeven

@ -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)));

Bestand weergeven

@ -1,6 +1,7 @@
<?php
namespace Todaymade\Daux\Tree;
use org\bovigo\vfs\vfsStream;
use Todaymade\Daux\Config;
use Todaymade\Daux\Daux;
use PHPUnit\Framework\TestCase;
@ -47,7 +48,6 @@ class BuilderTest extends TestCase
$config->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())
);
}
}