diff --git a/core/lib/Drupal/Component/Discovery/YamlDiscovery.php b/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
index 38c4d44..7cb1978 100644
--- a/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
+++ b/core/lib/Drupal/Component/Discovery/YamlDiscovery.php
@@ -22,7 +22,7 @@ class YamlDiscovery implements DiscoverableInterface {
   protected $name;
 
   /**
-   * An array of directories to scan.
+   * An array of directories to scan, keyed by the provider.
    *
    * @var array
    */
@@ -41,8 +41,7 @@ class YamlDiscovery implements DiscoverableInterface {
    * @param string $name
    *   The
    * @param array $directories
-   *   An array of directories to scan. If an associative array is provided the
-   *   return array will use these keys.
+   *   An array of directories to scan, keyed by the provider.
    */
   public function __construct($name, array $directories) {
     $this->name = $name;
@@ -83,27 +82,14 @@ protected function parser() {
    */
   protected function findFiles() {
     $files = array();
-    foreach ($this->directories as $key => $directory) {
-      $file = $directory . '/' . $this->fileBaseName($directory) . '.yml';
+    foreach ($this->directories as $provider => $directory) {
+      $file = $directory . '/' . $provider . '.' . $this->name . '.yml';
       if (file_exists($file)) {
-        $files[$key] = $file;
+        $files[$provider] = $file;
       }
     }
     return $files;
   }
 
-  /**
-   * Returns the base filename for the current directory.
-   *
-   * @param string $directory
-   *   The current directory path.
-   *
-   * @return string
-   *   The file name, without the .yml extension.
-   */
-  protected function fileBaseName($directory) {
-    return basename($directory) . '.' . $this->name;
-  }
-
 }
 
diff --git a/core/modules/system/tests/modules/router_test/router_test.info.yml b/core/modules/system/tests/modules/router_test/router_test.info.yml
deleted file mode 100644
index 8641b98..0000000
--- a/core/modules/system/tests/modules/router_test/router_test.info.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-name: 'Router test'
-type: module
-description: 'Support module for routing testing.'
-package: Testing
-version: VERSION
-core: 8.x
-hidden: true
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/Access/TestAccessCheck.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/TestAccessCheck.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/Access/TestAccessCheck.php
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/RouteTestSubscriber.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/RouteTestSubscriber.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/RouteTestSubscriber.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/RouteTestSubscriber.php
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/RouterTestServiceProvider.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/RouterTestServiceProvider.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/RouterTestServiceProvider.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/RouterTestServiceProvider.php
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/TestContent.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/TestContent.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestContent.php
diff --git a/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/TestControllers.php b/core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestControllers.php
similarity index 100%
rename from core/modules/system/tests/modules/router_test/lib/Drupal/router_test/TestControllers.php
rename to core/modules/system/tests/modules/router_test_directory/lib/Drupal/router_test/TestControllers.php
diff --git a/core/modules/system/tests/modules/router_test_directory/router_test.info.yml b/core/modules/system/tests/modules/router_test_directory/router_test.info.yml
new file mode 100644
index 0000000..915f0ff
--- /dev/null
+++ b/core/modules/system/tests/modules/router_test_directory/router_test.info.yml
@@ -0,0 +1,7 @@
+name: 'Router test'
+type: module
+description: 'Support module for routing testing. In a directory that does not match the module name to test that use case.'
+package: Testing
+version: VERSION
+core: 8.x
+hidden: true
diff --git a/core/modules/system/tests/modules/router_test/router_test.module b/core/modules/system/tests/modules/router_test_directory/router_test.module
similarity index 100%
rename from core/modules/system/tests/modules/router_test/router_test.module
rename to core/modules/system/tests/modules/router_test_directory/router_test.module
diff --git a/core/modules/system/tests/modules/router_test/router_test.routing.yml b/core/modules/system/tests/modules/router_test_directory/router_test.routing.yml
similarity index 100%
rename from core/modules/system/tests/modules/router_test/router_test.routing.yml
rename to core/modules/system/tests/modules/router_test_directory/router_test.routing.yml
