diff --git a/tests/src/Unit/YamlValidationTest.php b/tests/src/Unit/YamlValidationTest.php
index 5da6b679f58c8b41fcd82d4f4143d6df5306d63e..8354acb23442c2129c04a0075787d3ef3bb72200 100644
--- a/tests/src/Unit/YamlValidationTest.php
+++ b/tests/src/Unit/YamlValidationTest.php
@@ -6,45 +6,54 @@
 use Symfony\Component\Yaml\Yaml;
 
 /**
- * Validate requirements for config YAML.
+ * Verifies the configuration files are valid.
  *
- * YAML in modules' config/ directory should not have a uuid: key. We'll use
- * this test to check whether that's the case.
+ * Configuration files are considered valid if they do not contain a uuid key.
  *
  * @group examples
  */
 class YamlValidationTest extends TestCase {
 
   /**
-   * Find all the config YAML files and provide them to the test.
+   * Finds all the config YAML files and provide them to the test.
    *
    * @return array[]
-   *   An array of arrays of strings, suitable as a data provider. Strings are
-   *   paths to YAML files in config directories.
+   *   An array of arrays of filenames for YAML files in config directories.
    */
   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];
+    $path = realpath(__DIR__ . '/../../..') . '/modules';
+    $yaml_files = [];
+
+    $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
+    $filter = new \RecursiveCallbackFilterIterator($directory, function ($current, $key, $iterator) {
+      if ($current->isFile()) {
+        // Only accept files whose extension is .yml which are contained in a
+        // config directory.
+        if ($current->getExtension() === 'yml' && strpos($current->getPathName(), '/config/') !== FALSE) {
+          return TRUE;
         }
+
+        return FALSE;
       }
+
+      // Always accept a directory.
+      return TRUE;
+    });
+    $iterator = new \RecursiveIteratorIterator($filter);
+
+    foreach ($iterator as $info) {
+      $yaml_files[] = [$info->getPathname()];
     }
-    return $yaml_paths;
+
+    return $yaml_files;
   }
 
   /**
    * @dataProvider provideYamls
    */
-  public function testNoUuidsInConfig($yaml_path) {
-    $yaml = Yaml::parse(file_get_contents($yaml_path));
-    $this->assertArrayNotHasKey('uuid', $yaml, "YAML in this file contains a uuid key: $yaml_path");
+  public function testNoUuidsInConfig($yaml_file) {
+    $yaml = Yaml::parse(file_get_contents($yaml_file));
+    $this->assertArrayNotHasKey('uuid', $yaml, "$yaml_file contains a uuid key.");
   }
 
 }