add tests for dot_files to FinderFactoryTest.php

add test_dot_files_are_returned():
full directory content including .dot_file and .dot_dir
add public function test_dot_directory_contents_are_returned():
subdirectory .dot_dir content containing .dot_file
This commit is contained in:
Andreas Schneider
2021-09-19 01:01:14 +02:00
committed by GitHub
parent c8144cc4d7
commit 38336cafa8

View File

@@ -97,6 +97,46 @@ class FinderFactoryTest extends TestCase
], $this->getFilesArray($finder));
}
public function test_dot_files_are_returned(): void
{
$this->container->set('hidden_files', []);
$this->container->set('hide_dot_files', FALSE);
$finder = (new FinderFactory(
$this->container,
$this->config,
HiddenFiles::fromConfig($this->config)
))();
$finder->in($this->filePath('subdir'))->depth(0);
$this->assertInstanceOf(Finder::class, $finder);
$this->assertEquals([
'.dot_dir',
'.dot_file',
'alpha.scss',
'bravo.js',
'charlie.bash',
'delta.html',
'echo.yaml',
], $this->getFilesArray($finder));
}
public function test_dot_directory_contents_are_returned(): void
{
$this->container->set('hidden_files', []);
$this->container->set('hide_dot_files', FALSE);
$finder = (new FinderFactory(
$this->container,
$this->config,
HiddenFiles::fromConfig($this->config)
))();
$finder->in($this->filePath('subdir/.dot_dir'))->depth(0);
$this->assertInstanceOf(Finder::class, $finder);
$this->assertEquals(['.dot_file'], $this->getFilesArray($finder));
}
public function test_it_throws_a_runtime_exception_with_an_invalid_sort_order(): void
{
$this->container->set('sort_order', 'invalid');