function YamlTest::providerYamlFilesInCore
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest::providerYamlFilesInCore()
Data provider that lists all YAML files in core.
File
-
core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php, line 120
Class
- YamlTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Serialization%21Yaml.php/class/Yaml/8.9.x" title="Provides a YAML serialization implementation." class="local">\Drupal\Component\Serialization\Yaml</a> @group Serialization
Namespace
Drupal\Tests\Component\SerializationCode
public function providerYamlFilesInCore() {
$files = [];
$dirs = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . '/../../../../../', \RecursiveDirectoryIterator::FOLLOW_SYMLINKS));
foreach ($dirs as $dir) {
$pathname = $dir->getPathname();
// Exclude core/node_modules.
if ($dir->getExtension() == 'yml' && strpos($pathname, '/../../../../../node_modules') === FALSE) {
if (strpos($dir->getRealPath(), 'invalid_file') !== FALSE) {
// There are some intentionally invalid files provided for testing
// library API behaviors, ignore them.
continue;
}
$files[] = [
$dir->getRealPath(),
];
}
}
return $files;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.