diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
index 7e0c5e9..1ee1a97 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
@@ -193,4 +193,23 @@ class DependencyTest extends ModuleTestBase {
     $this->drupalPost(NULL, NULL, t('Uninstall'));
     $this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
   }
+
+  /**
+   * Tests that the module page doesn't prompt the user to enable an already
+   * enabled but hidden module when installing a module that depends on that
+   * hidden module.
+   */
+  function testHiddenEnabledModuleDependency() {
+    // Enable the module_test module so that we our module dependency is
+    // fullfilled. module_dependency_test module relies on module_dependency.
+    module_enable('module_test');
+    // Not set and enable throught the interface.
+    $edit = array('modules[Testing][module_dependency_test][enable]' => TRUE);
+    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
+    // Make sure we don't end up on the page asking us to enable 'Module test'
+    // module.
+    $this->assertNoText(t("You must enable the Module test module"), t("Enabled hidden module is asking to be enabled."));
+    // Finally make sure that the module was enabled.
+    $this->assertModules(array('module_dependency_test'), TRUE);
+  }
 }
diff --git a/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.info b/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.info
new file mode 100644
index 0000000..ef58e91
--- /dev/null
+++ b/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.info
@@ -0,0 +1,7 @@
+name = Module Dependecy Test
+description = "Support module for testing module dependency."
+package = Testing
+version = VERSION
+core = 8.x
+dependencies[] = module_test
+hidden = TRUE
diff --git a/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.module b/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.module
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/core/modules/system/tests/modules/module_dependency_test/module_dependecy_test.module
@@ -0,0 +1 @@
+<?php
diff --git a/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module
index 69e5bfe..65e2791 100644
--- a/core/modules/system/tests/modules/module_test/module_test.module
+++ b/core/modules/system/tests/modules/module_test/module_test.module
@@ -52,6 +52,10 @@ function module_test_system_info_alter(&$info, $file, $type) {
   if ($file->name == 'seven' && $type == 'theme') {
     $info['regions']['test_region'] = t('Test region');
   }
+
+  if ($file->name == 'module_dependency_test') {
+    $info['hidden'] = FALSE;
+  }
 }
 
 /**
