public function RegexDirectoryIteratorTest::testRegexDirectoryIterator in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php \Drupal\Tests\Component\FileSystem\RegexDirectoryIteratorTest::testRegexDirectoryIterator()
- 9 core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php \Drupal\Tests\Component\FileSystem\RegexDirectoryIteratorTest::testRegexDirectoryIterator()
@covers ::accept @dataProvider providerTestRegexDirectoryIterator
File
- core/
tests/ Drupal/ Tests/ Component/ FileSystem/ RegexDirectoryIteratorTest.php, line 19
Class
- RegexDirectoryIteratorTest
- @coversDefaultClass \Drupal\Component\FileSystem\RegexDirectoryIterator @group FileSystem
Namespace
Drupal\Tests\Component\FileSystemCode
public function testRegexDirectoryIterator(array $directory, $regex, array $expected) {
vfsStream::setup('root', NULL, $directory);
$iterator = new RegexDirectoryIterator(vfsStream::url('root'), $regex);
// Create an array of filenames to assert against.
$file_list = array_map(function (\SplFileInfo $file) {
return $file
->getFilename();
}, array_values(iterator_to_array($iterator)));
$this
->assertSame($expected, $file_list);
}