diff --git a/tests/allejo/stakx/Test/Filesystem/FileExplorerTest.php b/tests/allejo/stakx/Test/Filesystem/FileExplorerTest.php index b9b3f217..2b06659d 100644 --- a/tests/allejo/stakx/Test/Filesystem/FileExplorerTest.php +++ b/tests/allejo/stakx/Test/Filesystem/FileExplorerTest.php @@ -288,4 +288,36 @@ public function testCustomTimestampMatcher() $this->assertNotContains($file->getFilename(), 'old'); } } + + public function testIncludesSupercedesExcludes() + { + vfsStream::create([ + 'dist' => [ + 'css' => [ + 'styles.css' => '', + ], + 'images' => [ + 'image1.png' => '', + 'image2.png' => '', + ], + 'js' => [ + 'main.js' => '', + ], + 'index.html' => '', + 'about.html' => '', + ], + ]); + + $explorer = FileExplorer::create($this->rootDir->url(), ['/dist\/(css|images|js)\/.+/'], ['dist'])->getFileIterator(); + $blacklist = ['index.html', 'about.html']; + $fileCount = 0; + + /** @var File $file */ + foreach ($explorer as $file) { + ++$fileCount; + $this->assertNotContains($blacklist, $file->getFilename()); + } + + $this->assertEquals(4, $fileCount); + } }