function RoutePathTest::provideYamls

Same name in other branches
  1. 3.x tests/src/Unit/RoutePathTest.php \Drupal\Tests\examples\Unit\RoutePathTest::provideYamls()

Find all the routing 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 routing YAML files.

File

tests/src/Unit/RoutePathTest.php, line 24

Class

RoutePathTest
Validate paths for routes.

Namespace

Drupal\Tests\examples\Unit

Code

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, 'routing.yml') !== FALSE) {
            $yaml_paths[] = [
                $pathname,
            ];
        }
    }
    return $yaml_paths;
}