diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php
index 537a844..859b270 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -183,6 +183,9 @@ public function addProfile($name, $path) {
    */
   protected function add($type, $name, $path) {
     $pathname = "$path/$name.info.yml";
+    if (!file_exists(DRUPAL_ROOT . '/' . $pathname)) {
+      throw new \InvalidArgumentException("Unknown $type: $pathname not found.");
+    }
     $filename = file_exists("$path/$name.$type") ? "$name.$type" : NULL;
     $this->moduleList[$name] = new Extension($type, $pathname, $filename);
     $this->resetImplementations();
diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
index 6406698..020814f 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
@@ -73,6 +73,9 @@ public function setModuleList(array $module_list = array());
    *   The module name; e.g., 'node'.
    * @param string $path
    *   The module path; e.g., 'core/modules/node'.
+   *
+   * @throws \InvalidArgumentException
+   *   If the specified module path does not exist.
    */
   public function addModule($name, $path);
 
@@ -83,6 +86,9 @@ public function addModule($name, $path);
    *   The profile name; e.g., 'standard'.
    * @param string $path
    *   The profile path; e.g., 'core/profiles/standard'.
+   *
+   * @throws \InvalidArgumentException
+   *   If the specified installation profile path does not exist.
    */
   public function addProfile($name, $path);
 
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php
index eb0477f..de80575 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php
@@ -181,7 +181,7 @@ public function testBaseFieldComponent() {
    * Tests deleting field instance.
    */
   public function testDeleteFieldInstance() {
-    $this->enableModules(array('field_sql_storage', 'field_test'));
+    $this->enableModules(array('field_test'));
 
     $field_name = 'test_field';
     // Create a field and an instance.
diff --git a/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php b/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
index 8aa560b..fd76b66 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
@@ -21,7 +21,7 @@ class EmailItemTest extends FieldUnitTestBase {
    *
    * @var array
    */
-  public static $modules = array('email');
+  public static $modules = array('text');
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EmailFieldRdfaTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EmailFieldRdfaTest.php
index fa9775f..5d483a3 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EmailFieldRdfaTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EmailFieldRdfaTest.php
@@ -21,7 +21,7 @@ class EmailFieldRdfaTest extends FieldRdfaTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = array('email', 'text');
+  public static $modules = array('text');
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
index c0228ba..35f9921 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
@@ -29,7 +29,7 @@
  */
 class ViewExecutableTest extends ViewUnitTestBase {
 
-  public static $modules = array('system', 'node', 'comment', 'user', 'filter', 'entity', 'field', 'field_sql_storage', 'text');
+  public static $modules = array('system', 'node', 'comment', 'user', 'filter', 'entity', 'field', 'text');
 
   /**
    * Views used by this test.
diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
new file mode 100644
index 0000000..73e45c5
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Extension\ModuleHandlerTest.
+ */
+
+namespace Drupal\Tests\Core\Extension;
+
+use Drupal\Core\Extension\ModuleHandler;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests the module handler.
+ *
+ * @group Drupal
+ * @group Module
+ *
+ * @see \Drupal\Core\Extension\ModuleHandler
+ */
+class ModuleHandlerTest extends UnitTestCase {
+
+  /**
+   * The cache backend.
+   *
+   * @var \Drupal\Core\Cache\CacheBackendInterface|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $cacheBackend;
+
+  /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandler
+   */
+  protected $moduleHandler;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'Module handler',
+      'description' => 'Tests the module handler.',
+      'group' => 'Module',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
+
+    $this->moduleHandler = new ModuleHandler(array(), $this->cacheBackend);
+  }
+
+  /**
+   * Tests adding a module.
+   */
+  public function testAddModule() {
+    $this->cacheBackend->expects($this->once())
+      ->method('set')
+      ->with('module_implements', array());
+    $this->cacheBackend->expects($this->once())
+      ->method('delete')
+      ->with('hook_info');
+
+    $this->moduleHandler->addModule('module_handler_test', 'modules/module_handler_test');
+    $this->assertTrue($this->moduleHandler->moduleExists('module_handler_test'));
+  }
+
+  /**
+   * Tests adding a non-existing module.
+   *
+   * @expectedException \InvalidArgumentException
+   * @expectedExceptionMessage Unknown module: modules/non_existing/name.info.yml not found.
+   */
+  public function testAddModuleNonExisting() {
+    $this->moduleHandler->addModule('name', 'modules/non_existing');
+  }
+
+  /**
+   * Tests adding a profile.
+   */
+  public function testAddProfile() {
+    $this->cacheBackend->expects($this->once())
+      ->method('set')
+      ->with('module_implements', array());
+    $this->cacheBackend->expects($this->once())
+      ->method('delete')
+      ->with('hook_info');
+
+    $this->moduleHandler->addProfile('module_handler_test', 'modules/module_handler_test');
+    $this->assertTrue($this->moduleHandler->moduleExists('module_handler_test'));
+  }
+
+  /**
+   * Tests adding a non-existing installation profile.
+   *
+   * @expectedException \InvalidArgumentException
+   * @expectedExceptionMessage Unknown profile: profiles/non_existing/name.info.yml not found.
+   */
+  public function testAddProfileNonExisting() {
+    $this->moduleHandler->addProfile('name', 'profiles/non_existing');
+  }
+
+}
+
+// Explicitly map document root to this test directory.
+define('DRUPAL_ROOT', __DIR__);
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml
new file mode 100644
index 0000000..871f598
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml
@@ -0,0 +1,3 @@
+type: module
+core: 8.x
+name: 'ModuleHandler test module'
diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
new file mode 100644
index 0000000..638a3dc
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
@@ -0,0 +1,5 @@
+<?php
+
+function module_handler_test_hook($arg) {
+  return $arg;
+}
