function YamlValidationTest::provideYamls
Same name in other branches
- 3.x tests/src/Unit/YamlValidationTest.php \Drupal\Tests\examples\Unit\YamlValidationTest::provideYamls()
Find all the config YAML files and provide them to the test.
Return value
array[] An array of arrays of strings, suitable as a data provider. Strings are paths to YAML files in config directories.
File
-
tests/
src/ Unit/ YamlValidationTest.php, line 25
Class
- YamlValidationTest
- Validate requirements for config YAML.
Namespace
Drupal\Tests\examples\UnitCode
public function provideYamls() {
$yaml_paths = [];
$examples_project_path = realpath(__DIR__ . '/../../..');
$paths = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($examples_project_path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS));
foreach ($paths as $path) {
$pathname = $path->getPathname();
if (strpos($pathname, '.yml') !== FALSE) {
if (strpos($pathname, '/config/') !== FALSE) {
$yaml_paths[] = [
$pathname,
];
}
}
}
return $yaml_paths;
}