diff --git a/core/modules/system/tests/modules/module_installer_child/module_installer_child.info.yml b/core/modules/system/tests/modules/module_installer_child/module_installer_child.info.yml
new file mode 100644
index 0000000..59a3461
--- /dev/null
+++ b/core/modules/system/tests/modules/module_installer_child/module_installer_child.info.yml
@@ -0,0 +1,5 @@
+core: 8.x
+type: module
+name: Module installer test parent
+dependencies:
+  - module_installer_parent
diff --git a/core/modules/system/tests/modules/module_installer_child/module_installer_child.services.yml b/core/modules/system/tests/modules/module_installer_child/module_installer_child.services.yml
new file mode 100644
index 0000000..cca59a6
--- /dev/null
+++ b/core/modules/system/tests/modules/module_installer_child/module_installer_child.services.yml
@@ -0,0 +1,4 @@
+services:
+  module_installer_child.example_service:
+    class: \stdClass
+    arguments: ['@module_installer_parent.example_service']
diff --git a/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.info.yml b/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.info.yml
new file mode 100644
index 0000000..9e69a39
--- /dev/null
+++ b/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.info.yml
@@ -0,0 +1,3 @@
+core: 8.x
+type: module
+name: Module installer test parent
diff --git a/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.services.yml b/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.services.yml
new file mode 100644
index 0000000..6722de8
--- /dev/null
+++ b/core/modules/system/tests/modules/module_installer_parent/module_installer_parent.services.yml
@@ -0,0 +1,3 @@
+services:
+  module_installer_parent.example_service:
+    class: \stdClass
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
index c15e7fb..0cb82b7 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\KernelTests\Core\Extension;
 
 use Drupal\Core\Database\Database;
+use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\Routing\Exception\RouteNotFoundException;
 
@@ -44,4 +45,22 @@ public function testRouteRebuild() {
     $this->container->get('router.route_provider')->getRouteByName('router_test.1');
   }
 
+  /**
+   * Tests that module dependencies order is taken into account.
+   *
+   * @covers ::install
+   */
+  public function testModuleDependenciesOrder() {
+    $this->getModuleInstaller()->install(['module_installer_child', 'module_installer_parent']);
+  }
+
+  /**
+   * Returns the module installer.
+   *
+   * @return \Drupal\Core\Extension\ModuleInstaller
+   */
+  protected function getModuleInstaller() {
+    return $this->container->get('module_installer');
+  }
+
 }
