diff --git a/core/core.services.yml b/core/core.services.yml
index 183f7e2..fda172a 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -42,6 +42,7 @@ services:
     arguments: ['@database']
   cache.backend.apcu:
     class: Drupal\Core\Cache\ApcuBackendFactory
+    arguments: ['%app.root%']
   cache.backend.php:
     class: Drupal\Core\Cache\PhpBackendFactory
   cache.bootstrap:
@@ -270,10 +271,10 @@ services:
     arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
   module_handler:
     class: Drupal\Core\Extension\ModuleHandler
-    arguments: ['%container.modules%', '@cache.bootstrap']
+    arguments: ['%app.root%', '%container.modules%', '@cache.bootstrap']
   theme_handler:
     class: Drupal\Core\Extension\ThemeHandler
-    arguments: ['@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@router.builder']
+    arguments: ['%app.root%', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@router.builder']
   entity.manager:
     class: Drupal\Core\Entity\EntityManager
     arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager']
@@ -872,10 +873,10 @@ services:
     arguments: ['@theme_handler', '@theme.registry', '@theme.negotiator', '@theme.initialization', '@request_stack']
   theme.initialization:
     class: Drupal\Core\Theme\ThemeInitialization
-    arguments: ['@theme_handler', '@state']
+    arguments: ['%app.root%', '@theme_handler', '@state']
   theme.registry:
     class: Drupal\Core\Theme\Registry
-    arguments: ['@cache.default', '@lock', '@module_handler']
+    arguments: ['%app.root%', '@cache.default', '@lock', '@module_handler']
     tags:
       - { name: needs_destruction }
   authentication:
@@ -932,10 +933,10 @@ services:
       - { name: needs_destruction }
   library.discovery.parser:
     class: Drupal\Core\Asset\LibraryDiscoveryParser
-    arguments: ['@module_handler']
+    arguments: ['%app.root%', '@module_handler']
   info_parser:
     class: Drupal\Core\Extension\InfoParser
-  twig:
+  twigloadActiveTheme:
     class: Drupal\Core\Template\TwigEnvironment
     arguments: ['@twig.loader', '@module_handler', '@theme_handler', '%twig.config%']
     tags:
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 27494e7..1c19892 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -340,7 +340,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
     }
     // If still unknown, perform a filesystem scan.
     if (!isset($files[$type][$name])) {
-      $listing = new ExtensionDiscovery();
+      $listing = new ExtensionDiscovery(\Drupal::root());
       // Prevent an infinite recursion by this legacy function.
       if ($original_type == 'profile') {
         $listing->setProfileDirectories(array());
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 3a877a8..21744a8 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -323,6 +323,7 @@ function install_begin_request(&$install_state) {
   $container
     ->register('path.matcher', 'Drupal\Core\Path\PathMatcher')
     ->addArgument(new Reference('config.factory'));
+  $container->setParameter('app.root', DRUPAL_ROOT);
 
   \Drupal::setContainer($container);
 
@@ -383,7 +384,7 @@ function install_begin_request(&$install_state) {
   }
 
   // Add list of all available profiles to the installation state.
-  $listing = new ExtensionDiscovery();
+  $listing = new ExtensionDiscovery($container->getParameter('app.root'));
   $listing->setProfileDirectories(array());
   $install_state['profiles'] += $listing->scan('profile');
 
diff --git a/core/includes/install.inc b/core/includes/install.inc
index d1c1596..40d5d89 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -591,7 +591,7 @@ function drupal_verify_profile($install_state) {
   $info = $install_state['profile_info'];
 
   // Get the list of available modules for the selected installation profile.
-  $listing = new ExtensionDiscovery();
+  $listing = new ExtensionDiscovery(DRUPAL_ROOT);
   $present_modules = array();
   foreach ($listing->scan('module') as $present_module) {
     $present_modules[] = $present_module->getName();
diff --git a/core/includes/module.inc b/core/includes/module.inc
index 023c102..0749e58 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -142,7 +142,7 @@ function module_load_include($type, $module, $name = NULL) {
   }
 
   if (function_exists('drupal_get_path')) {
-    $file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
+    $file = \Drupal::root() . '/' . drupal_get_path('module', $module) . "/$name.$type";
     if (is_file($file)) {
       require_once $file;
       return $file;
@@ -179,7 +179,7 @@ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE)
  * Returns an array of modules required by core.
  */
 function drupal_required_modules() {
-  $listing = new ExtensionDiscovery();
+  $listing = new ExtensionDiscovery(\Drupal::root());
   $files = $listing->scan('module');
   $required = array();
 
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 08ad960..3cad5e6 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -343,7 +343,7 @@ function _theme($hook, $variables = array()) {
   // elsewhere.
   if (!empty($info['includes'])) {
     foreach ($info['includes'] as $include_file) {
-      include_once DRUPAL_ROOT . '/' . $include_file;
+      include_once \Drupal::root() . '/' . $include_file;
     }
   }
 
@@ -355,7 +355,7 @@ function _theme($hook, $variables = array()) {
     // might reside there.
     if (!empty($base_hook_info['includes'])) {
       foreach ($base_hook_info['includes'] as $include_file) {
-        include_once DRUPAL_ROOT . '/' . $include_file;
+        include_once \Drupal::root() . '/' . $include_file;
       }
     }
     // Replace the preprocess functions with those from the base hook.
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index fcc6476..a6e2ed6 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -152,6 +152,15 @@ public static function hasService($id) {
   }
 
   /**
+   * Gets the app root.
+   *
+   * @return string
+   */
+  public static function root() {
+    return static::$container->get('app.root');
+  }
+
+  /**
    * Indicates if there is a currently active request object.
    *
    * @return bool
diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
index bd962bd..a28ca6e 100644
--- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -27,10 +27,22 @@ class LibraryDiscoveryParser {
   protected $moduleHandler;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
+   * Constructs a new LibraryDiscoveryParser instance.
+   *
+   * @param string $root
+   *   The app root.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
    */
-  public function __construct(ModuleHandlerInterface $module_handler) {
+  public function __construct($root, ModuleHandlerInterface $module_handler) {
+    $this->root = $root;
     $this->moduleHandler = $module_handler;
   }
 
@@ -67,7 +79,7 @@ public function buildByExtension($extension) {
 
     $library_file = $path . '/' . $extension . '.libraries.yml';
 
-    if ($library_file && file_exists(DRUPAL_ROOT . '/' . $library_file)) {
+    if ($library_file && file_exists($this->root . '/' . $library_file)) {
       $libraries = $this->parseLibraryInfo($extension, $library_file);
     }
 
@@ -222,7 +234,7 @@ public function buildByExtension($extension) {
    */
   protected function parseLibraryInfo($extension, $library_file) {
     try {
-      $libraries = Yaml::decode(file_get_contents(DRUPAL_ROOT . '/' . $library_file));
+      $libraries = Yaml::decode(file_get_contents($this->root . '/' . $library_file));
     }
     catch (InvalidDataTypeException $e) {
       // Rethrow a more helpful exception to provide context.
diff --git a/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
index 341203c..ffe5993 100644
--- a/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
+++ b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
@@ -20,9 +20,12 @@ class ApcuBackendFactory implements CacheFactoryInterface {
 
   /**
    * Constructs an ApcuBackendFactory object.
+   *
+   * @param string $root
+   *   The app root.
    */
-  public function __construct() {
-    $this->sitePrefix = Crypt::hashBase64(DRUPAL_ROOT . '/' . conf_path());
+  public function __construct($root) {
+    $this->sitePrefix = Crypt::hashBase64($root . '/' . conf_path());
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php
index e9bd690..d4e7d5c 100644
--- a/core/lib/Drupal/Core/Config/InstallStorage.php
+++ b/core/lib/Drupal/Core/Config/InstallStorage.php
@@ -157,7 +157,7 @@ protected function getAllFolders() {
       if ($profile = drupal_get_profile()) {
         $this->folders += $this->getComponentNames('profile', array($profile));
       }
-      $listing = new ExtensionDiscovery();
+      $listing = new ExtensionDiscovery(DRUPAL_ROOT);
       $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module')));
       $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('theme')));
     }
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index da657c5..70a4a12 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -589,7 +589,7 @@ public function prepareLegacyRequest(Request $request) {
   protected function moduleData($module) {
     if (!$this->moduleData) {
       // First, find profiles.
-      $listing = new ExtensionDiscovery();
+      $listing = new ExtensionDiscovery(DRUPAL_ROOT);
       $listing->setProfileDirectories(array());
       $all_profiles = $listing->scan('profile');
       $profiles = array_intersect_key($all_profiles, $this->moduleList);
@@ -989,6 +989,8 @@ protected function attachSynthetic(ContainerInterface $container) {
 
     // Set the class loader which was registered as a synthetic service.
     $container->set('class_loader', $this->classLoader);
+
+    $container->set('app.root', DRUPAL_ROOT);
     return $container;
   }
 
diff --git a/core/lib/Drupal/Core/Extension/Extension.php b/core/lib/Drupal/Core/Extension/Extension.php
index 5c47824..dbf478e 100644
--- a/core/lib/Drupal/Core/Extension/Extension.php
+++ b/core/lib/Drupal/Core/Extension/Extension.php
@@ -75,8 +75,17 @@ class Extension implements \Serializable {
   protected $splFileInfo;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * Constructs a new Extension object.
    *
+   * @param string $root
+   *   The app root.
    * @param string $type
    *   The type of the extension; e.g., 'module'.
    * @param string $pathname
@@ -85,7 +94,8 @@ class Extension implements \Serializable {
    * @param string $filename
    *   (optional) The filename of the main extension file; e.g., 'node.module'.
    */
-  public function __construct($type, $pathname, $filename = NULL) {
+  public function __construct($root, $type, $pathname, $filename = NULL) {
+    $this->root = $root;
     $this->type = $type;
     $this->pathname = $pathname;
     $this->_filename = $filename;
@@ -168,7 +178,7 @@ public function getExtensionFilename() {
    */
   public function load() {
     if ($this->_filename) {
-      include_once DRUPAL_ROOT . '/' . $this->getPath() . '/' . $this->_filename;
+      include_once $this->root . '/' . $this->getPath() . '/' . $this->_filename;
       return TRUE;
     }
     return FALSE;
diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
index f51cbb3..9681162 100644
--- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
+++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
@@ -74,13 +74,30 @@ class ExtensionDiscovery {
   protected $profileDirectories;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
+   * Constructs a new ExtensionDiscovery object.
+   *
+   * @param string $root
+   *   The app root.
+   */
+  public function __construct($root) {
+    $this->root = $root;
+  }
+
+  /**
    * Discovers available extensions of a given type.
    *
    * Finds all extensions (modules, themes, etc) that exist on the site. It
    * searches in several locations. For instance, to discover all available
    * modules:
    * @code
-   * $listing = new ExtensionDiscovery();
+   * $listing = new ExtensionDiscovery(\Drupal::root());
    * $modules = $listing->scan('module');
    * @endcode
    *
@@ -304,9 +321,9 @@ protected function scanDirectory($dir, $include_tests) {
     // be used (which also improves performance, since any configured PHP
     // include_paths will not be consulted). Retain the relative originating
     // directory being scanned, so relative paths can be reconstructed below
-    // (all paths are expected to be relative to DRUPAL_ROOT).
+    // (all paths are expected to be relative to $this->root).
     $dir_prefix = ($dir == '' ? '' : "$dir/");
-    $absolute_dir = ($dir == '' ? DRUPAL_ROOT : DRUPAL_ROOT . "/$dir");
+    $absolute_dir = ($dir == '' ? $this->root : $this->root . "/$dir");
 
     if (!is_dir($absolute_dir)) {
       return $files;
@@ -370,7 +387,7 @@ protected function scanDirectory($dir, $include_tests) {
         $filename = NULL;
       }
 
-      $extension = new Extension($type, $pathname, $filename);
+      $extension = new Extension($this->root, $type, $pathname, $filename);
 
       // Track the originating directory for sorting purposes.
       $extension->subpath = $fileinfo->getSubPath();
diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php
index cb65449..263311f 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -87,8 +87,17 @@ class ModuleHandler implements ModuleHandlerInterface {
   protected $alterFunctions;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * Constructs a ModuleHandler object.
    *
+   * @param string $root
+   *   The app root.
    * @param array $module_list
    *   An associative array whose keys are the names of installed modules and
    *   whose values are Extension class parameters. This is normally the
@@ -99,10 +108,11 @@ class ModuleHandler implements ModuleHandlerInterface {
    * @see \Drupal\Core\DrupalKernel
    * @see \Drupal\Core\CoreServiceProvider
    */
-  public function __construct(array $module_list = array(), CacheBackendInterface $cache_backend) {
+  public function __construct($root, array $module_list = array(), CacheBackendInterface $cache_backend) {
+    $this->root = $root;
     $this->moduleList = array();
     foreach ($module_list as $name => $module) {
-      $this->moduleList[$name] = new Extension($module['type'], $module['pathname'], $module['filename']);
+      $this->moduleList[$name] = new Extension($this->root, $module['type'], $module['pathname'], $module['filename']);
     }
     $this->cacheBackend = $cache_backend;
   }
@@ -203,8 +213,8 @@ public function addProfile($name, $path) {
    */
   protected function add($type, $name, $path) {
     $pathname = "$path/$name.info.yml";
-    $filename = file_exists(DRUPAL_ROOT . "/$path/$name.$type") ? "$name.$type" : NULL;
-    $this->moduleList[$name] = new Extension($type, $pathname, $filename);
+    $filename = file_exists($this->root . "/$path/$name.$type") ? "$name.$type" : NULL;
+    $this->moduleList[$name] = new Extension($this->root, $type, $pathname, $filename);
     $this->resetImplementations();
   }
 
@@ -253,12 +263,12 @@ public function loadAllIncludes($type, $name = NULL) {
   public function loadInclude($module, $type, $name = NULL) {
     if ($type == 'install') {
       // Make sure the installation API is available
-      include_once DRUPAL_ROOT . '/core/includes/install.inc';
+      include_once $this->root . '/core/includes/install.inc';
     }
 
     $name = $name ?: $module;
     if (isset($this->moduleList[$module])) {
-      $file = DRUPAL_ROOT . '/' . $this->moduleList[$module]->getPath() . "/$name.$type";
+      $file = $this->root . '/' . $this->moduleList[$module]->getPath() . "/$name.$type";
       if (is_file($file)) {
         require_once $file;
         return $file;
@@ -727,7 +737,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
     }
 
     // Required for module installation checks.
-    include_once DRUPAL_ROOT . '/core/includes/install.inc';
+    include_once $this->root . '/core/includes/install.inc';
 
     /** @var \Drupal\Core\Config\ConfigInstaller $config_installer */
     $config_installer = \Drupal::service('config.installer');
@@ -774,7 +784,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
             $module_path = drupal_get_path('module', $name);
             $pathname = "$module_path/$name.info.yml";
             $filename = file_exists($module_path . "/$name.module") ? "$name.module" : NULL;
-            $module_filenames[$name] = new Extension('module', $pathname, $filename);
+            $module_filenames[$name] = new Extension($this->root, 'module', $pathname, $filename);
           }
         }
 
@@ -1063,7 +1073,7 @@ protected function removeCacheBins($module) {
   public function getModuleDirectories() {
     $dirs = array();
     foreach ($this->getModuleList() as $name => $module) {
-      $dirs[$name] = DRUPAL_ROOT . '/' . $module->getPath();
+      $dirs[$name] = $this->root . '/' . $module->getPath();
     }
     return $dirs;
   }
diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php
index d9ef77e..87878de 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandler.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -109,8 +109,17 @@ class ThemeHandler implements ThemeHandlerInterface {
   protected $cssCollectionOptimizer;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * Constructs a new ThemeHandler.
    *
+   * @param string $root
+   *   The app root.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory to get the enabled themes.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
@@ -132,7 +141,8 @@ class ThemeHandler implements ThemeHandlerInterface {
    * @param \Drupal\Core\Extension\ExtensionDiscovery $extension_discovery
    *   (optional) A extension discovery instance (for unit tests).
    */
-  public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, RouteBuilder $route_builder = NULL, ExtensionDiscovery $extension_discovery = NULL) {
+  public function __construct($root, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, RouteBuilder $route_builder = NULL, ExtensionDiscovery $extension_discovery = NULL) {
+    $this->root = $root;
     $this->configFactory = $config_factory;
     $this->moduleHandler = $module_handler;
     $this->state = $state;
@@ -355,7 +365,7 @@ public function disable(array $theme_list) {
    * {@inheritdoc}
    */
   public function listInfo() {
-    if (!isset($this->list)) {
+    if (TRUE || !isset($this->list)) {
       $this->list = array();
       $themes = $this->systemThemeList();
       // @todo Ensure that systemThemeList() does not contain an empty list
@@ -627,7 +637,7 @@ protected function doGetBaseThemes(array $themes, $theme, $used_themes = array()
    */
   protected function getExtensionDiscovery() {
     if (!isset($this->extensionDiscovery)) {
-      $this->extensionDiscovery = new ExtensionDiscovery();
+      $this->extensionDiscovery = new ExtensionDiscovery($this->root);
     }
     return $this->extensionDiscovery;
   }
@@ -688,7 +698,7 @@ protected function systemThemeList() {
   public function getThemeDirectories() {
     $dirs = array();
     foreach ($this->listInfo() as $name => $theme) {
-      $dirs[$name] = DRUPAL_ROOT . '/' . $theme->getPath();
+      $dirs[$name] = $this->root . '/' . $theme->getPath();
     }
     return $dirs;
   }
diff --git a/core/lib/Drupal/Core/Test/TestRunnerKernel.php b/core/lib/Drupal/Core/Test/TestRunnerKernel.php
index 60e55bd..6280439 100644
--- a/core/lib/Drupal/Core/Test/TestRunnerKernel.php
+++ b/core/lib/Drupal/Core/Test/TestRunnerKernel.php
@@ -42,8 +42,8 @@ public function __construct($environment, ClassLoader $class_loader) {
       'simpletest' => 0,
     );
     $this->moduleData = array(
-      'system' => new Extension('module', 'core/modules/system/system.info.yml', 'system.module'),
-      'simpletest' => new Extension('module', 'core/modules/simpletest/simpletest.info.yml', 'simpletest.module'),
+      'system' => new Extension(DRUPAL_ROOT, 'module', 'core/modules/system/system.info.yml', 'system.module'),
+      'simpletest' => new Extension(DRUPAL_ROOT, 'module', 'core/modules/simpletest/simpletest.info.yml', 'simpletest.module'),
     );
   }
 
diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php
index 0ad005d..9900aff 100644
--- a/core/lib/Drupal/Core/Theme/Registry.php
+++ b/core/lib/Drupal/Core/Theme/Registry.php
@@ -130,8 +130,17 @@ class Registry implements DestructableInterface {
   protected $themeName;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * Constructs a \Drupal\Core\\Theme\Registry object.
    *
+   * @param string $root
+   *   The app root.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache
    *   The cache backend interface to use for the complete theme registry data.
    * @param \Drupal\Core\Lock\LockBackendInterface $lock
@@ -141,7 +150,8 @@ class Registry implements DestructableInterface {
    * @param string $theme_name
    *   (optional) The name of the theme for which to construct the registry.
    */
-  public function __construct(CacheBackendInterface $cache, LockBackendInterface $lock, ModuleHandlerInterface $module_handler, $theme_name = NULL) {
+  public function __construct($root, CacheBackendInterface $cache, LockBackendInterface $lock, ModuleHandlerInterface $module_handler, $theme_name = NULL) {
+    $this->root = $root;
     $this->cache = $cache;
     $this->lock = $lock;
     $this->moduleHandler = $module_handler;
diff --git a/core/lib/Drupal/Core/Theme/ThemeInitialization.php b/core/lib/Drupal/Core/Theme/ThemeInitialization.php
index c6d800e..f521a0a 100644
--- a/core/lib/Drupal/Core/Theme/ThemeInitialization.php
+++ b/core/lib/Drupal/Core/Theme/ThemeInitialization.php
@@ -32,14 +32,24 @@ class ThemeInitialization implements ThemeInitializationInterface {
   protected $state;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * Constructs a new ThemeInitialization object.
    *
+   * @param string $root
+   *   The app root.
    * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
    *   The theme handler.
    * @param \Drupal\Core\State\StateInterface $state
    *   The state.
    */
-  public function __construct(ThemeHandlerInterface $theme_handler, StateInterface $state) {
+  public function __construct($root, ThemeHandlerInterface $theme_handler, StateInterface $state) {
+    $this->root = $root;
     $this->themeHandler = $theme_handler;
     $this->state = $state;
   }
@@ -77,7 +87,7 @@ public function getActiveThemeByName($theme_name) {
       $theme_name = 'core';
       // /core/core.info.yml does not actually exist, but is required because
       // Extension expects a pathname.
-      $active_theme = $this->getActiveTheme(new Extension('theme', 'core/core.info.yml'));
+      $active_theme = $this->getActiveTheme(new Extension($this->root, 'theme', 'core/core.info.yml'));
 
       // Early-return and do not set state, because the initialized $theme_name
       // differs from the original $theme_name.
@@ -105,7 +115,7 @@ public function loadActiveTheme(ActiveTheme $active_theme) {
     // Initialize the theme.
     if ($theme_engine = $active_theme->getEngine()) {
       // Include the engine.
-      include_once DRUPAL_ROOT . '/' . $active_theme->getOwner();
+      include_once $this->root . '/' . $active_theme->getOwner();
 
       if (function_exists($theme_engine . '_init')) {
         foreach ($active_theme->getBaseThemes() as $base) {
@@ -119,17 +129,17 @@ public function loadActiveTheme(ActiveTheme $active_theme) {
       foreach ($active_theme->getBaseThemes() as $base) {
         // Include the theme file or the engine.
         if ($base->getOwner()) {
-          include_once DRUPAL_ROOT . '/' . $base->getOwner();
+          include_once $this->root . '/' . $base->getOwner();
         }
       }
       // and our theme gets one too.
       if ($active_theme->getOwner()) {
-        include_once DRUPAL_ROOT . '/' . $active_theme->getOwner();
+        include_once $this->root . '/' . $active_theme->getOwner();
       }
     }
 
     // Always include Twig as the default theme engine.
-    include_once DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine';
+    include_once $this->root . '/core/themes/engines/twig/twig.engine';
   }
 
   /**
diff --git a/core/modules/config/tests/config_test/src/TestInstallStorage.php b/core/modules/config/tests/config_test/src/TestInstallStorage.php
index f85de95..a689efc 100644
--- a/core/modules/config/tests/config_test/src/TestInstallStorage.php
+++ b/core/modules/config/tests/config_test/src/TestInstallStorage.php
@@ -25,7 +25,7 @@ protected function getAllFolders() {
     if (!isset($this->folders)) {
       $this->folders = $this->getComponentNames('core', array('core'));
       // @todo Refactor getComponentNames() to use the extension list directly.
-      $listing = new ExtensionDiscovery();
+      $listing = new ExtensionDiscovery(DRUPAL_ROOT);
       $listing->setProfileDirectories(array());
       $this->folders += $this->getComponentNames('profile', array_keys($listing->scan('profile')));
       $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module')));
diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php
index 144e2a4..7e01f49 100644
--- a/core/modules/simpletest/src/TestDiscovery.php
+++ b/core/modules/simpletest/src/TestDiscovery.php
@@ -441,7 +441,7 @@ public static function parseTestClassAnnotations(\ReflectionClass $class) {
    *   An array of Extension objects, keyed by extension name.
    */
   protected function getExtensions() {
-    $listing = new ExtensionDiscovery();
+    $listing = new ExtensionDiscovery(DRUPAL_ROOT);
     // Ensure that tests in all profiles are discovered.
     $listing->setProfileDirectories(array());
     $extensions = $listing->scan('module', TRUE);
diff --git a/core/modules/system/src/Tests/Common/SystemListingTest.php b/core/modules/system/src/Tests/Common/SystemListingTest.php
index fc1cebf..de6a941 100644
--- a/core/modules/system/src/Tests/Common/SystemListingTest.php
+++ b/core/modules/system/src/Tests/Common/SystemListingTest.php
@@ -43,7 +43,7 @@ function testDirectoryPrecedence() {
 
     // Now scan the directories and check that the files take precedence as
     // expected.
-    $listing = new ExtensionDiscovery();
+    $listing = new ExtensionDiscovery(\Drupal::root());
     $listing->setProfileDirectories(array('core/profiles/testing'));
     $files = $listing->scan('module');
     foreach ($expected_directories as $module => $directories) {
diff --git a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
index 26aa7ec..97e8068 100644
--- a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
@@ -79,7 +79,7 @@ protected function setUp() {
     parent::setUp();
 
     // Enable all available non-testing themes.
-    $listing = new ExtensionDiscovery();
+    $listing = new ExtensionDiscovery(\Drupal::root());
     $this->themes = $listing->scan('theme', FALSE);
     theme_enable(array_keys($this->themes));
 
diff --git a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php b/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
index 698b66d..08b2912 100644
--- a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
+++ b/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
@@ -38,7 +38,7 @@ protected function setUp() {
     $this->installConfig(array('system'));
 
     if (!isset($this->availableThemes)) {
-      $discovery = new ExtensionDiscovery();
+      $discovery = new ExtensionDiscovery(\Drupal::root());
       $this->availableThemes = $discovery->scan('theme');
     }
   }
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index ddf052e..20ebf27 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1180,7 +1180,7 @@ function system_get_info($type, $name = NULL) {
  *   An associative array of module information.
  */
 function _system_rebuild_module_data() {
-  $listing = new ExtensionDiscovery();
+  $listing = new ExtensionDiscovery(\Drupal::root());
   // Find modules
   $modules = $listing->scan('module');
 
diff --git a/core/modules/system/tests/src/Menu/SystemLocalTasksTest.php b/core/modules/system/tests/src/Menu/SystemLocalTasksTest.php
index 11a0851..9664edc 100644
--- a/core/modules/system/tests/src/Menu/SystemLocalTasksTest.php
+++ b/core/modules/system/tests/src/Menu/SystemLocalTasksTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
 
     $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
 
-    $theme = new Extension('theme', DRUPAL_ROOT . '/core/themes/bartik', 'bartik.info.yml');
+    $theme = new Extension(DRUPAL_ROOT, 'theme', DRUPAL_ROOT . '/core/themes/bartik', 'bartik.info.yml');
     $theme->status = 1;
     $theme->info = array('name' => 'bartik');
     $this->themeHandler->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
index 89a878c..d4a9fe4 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -10,10 +10,6 @@
 use Drupal\Core\Asset\LibraryDiscoveryParser;
 use Drupal\Tests\UnitTestCase;
 
-if (!defined('DRUPAL_ROOT')) {
-  define('DRUPAL_ROOT', dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))));
-}
-
 if (!defined('CSS_AGGREGATE_DEFAULT')) {
   define('CSS_AGGREGATE_DEFAULT', 0);
   define('CSS_AGGREGATE_THEME', 100);
@@ -67,7 +63,8 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
    */
   protected function setUp() {
     $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-    $this->libraryDiscoveryParser = new TestLibraryDiscoveryParser($this->moduleHandler);
+    $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
+    $this->libraryDiscoveryParser = new TestLibraryDiscoveryParser($root, $this->moduleHandler);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
index bc5da97..73d81ab 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
@@ -33,13 +33,21 @@ class ModuleHandlerTest extends UnitTestCase {
   protected $moduleHandler;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * {@inheritdoc}
    *
    * @covers ::__construct
    */
   protected function setUp() {
     $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $this->moduleHandler = new ModuleHandler(array(
+    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
+    $this->moduleHandler = new ModuleHandler($this->root, array(
       'module_handler_test' => array(
         'type' => 'module',
         'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
@@ -90,6 +98,7 @@ public function testLoadAllModules() {
   public function testModuleReloading() {
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
+        $this->root,
         array(
           'module_handler_test' => array(
             'type' => 'module',
@@ -134,7 +143,7 @@ public function testIsLoaded() {
    */
   public function testGetModuleList() {
     $this->assertEquals($this->moduleHandler->getModuleList(), array(
-      'module_handler_test' => new Extension('module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module'),
+      'module_handler_test' => new Extension($this->root, 'module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module'),
     ));
   }
 
@@ -144,7 +153,7 @@ public function testGetModuleList() {
    * @covers ::getModule
    */
   public function testGetModuleWithExistingModule() {
-    $this->assertEquals($this->moduleHandler->getModule('module_handler_test'), new Extension('module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module'));
+    $this->assertEquals($this->moduleHandler->getModule('module_handler_test'), new Extension($this->root, 'module', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml', 'module_handler_test.module'));
   }
 
   /**
@@ -164,7 +173,7 @@ public function testGetModuleWithNonExistingModule() {
   public function testSetModuleList() {
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
-        array(), $this->cacheBackend
+        $this->root, array(), $this->cacheBackend
       ))
       ->setMethods(array('resetImplementations'))
       ->getMock();
@@ -192,7 +201,7 @@ public function testAddModule() {
 
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
-        array(), $this->cacheBackend
+        $this->root, array(), $this->cacheBackend
       ))
       ->setMethods(array('resetImplementations'))
       ->getMock();
@@ -214,7 +223,7 @@ public function testAddProfile() {
 
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
-        array(), $this->cacheBackend
+        $this->root, array(), $this->cacheBackend
       ))
       ->setMethods(array('resetImplementations'))
       ->getMock();
@@ -244,6 +253,7 @@ public function testLoadAllIncludes() {
     $this->assertTrue(true);
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
+        $this->root,
         array(
           'module_handler_test' => array(
             'type' => 'module',
@@ -325,7 +335,7 @@ public function testCachedGetImplementations() {
     // Ensure buildImplementationInfo doesn't get called and that we work off cached results.
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
-        array(
+        $this->root, array(
           'module_handler_test' => array(
             'type' => 'module',
             'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
@@ -360,7 +370,7 @@ public function testCachedGetImplementationsMissingMethod() {
     // Ensure buildImplementationInfo doesn't get called and that we work off cached results.
     $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
       ->setConstructorArgs(array(
-        array(
+        $this->root, array(
           'module_handler_test' => array(
             'type' => 'module',
             'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
index 0627137..0b80249 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
@@ -85,6 +85,13 @@ class ThemeHandlerTest extends UnitTestCase {
   protected $themeHandler;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
@@ -111,7 +118,8 @@ protected function setUp() {
       ->disableOriginalConstructor()
       ->getMock();
     $logger = $this->getMock('Psr\Log\LoggerInterface');
-    $this->themeHandler = new TestThemeHandler($this->configFactory, $this->moduleHandler, $this->state, $this->infoParser, $logger, $this->cssCollectionOptimizer, $this->configInstaller, $this->routeBuilder, $this->extensionDiscovery);
+    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
+    $this->themeHandler = new TestThemeHandler($this->root, $this->configFactory, $this->moduleHandler, $this->state, $this->infoParser, $logger, $this->cssCollectionOptimizer, $this->configInstaller, $this->routeBuilder, $this->extensionDiscovery);
 
     $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
     $this->getContainerWithCacheBins($cache_backend);
@@ -127,17 +135,17 @@ public function testRebuildThemeData() {
       ->method('scan')
       ->with('theme')
       ->will($this->returnValue(array(
-        'seven' => new Extension('theme', DRUPAL_ROOT . '/core/themes/seven/seven.info.yml', 'seven.theme'),
+        'seven' => new Extension($this->root, 'theme', $this->root . '/core/themes/seven/seven.info.yml', 'seven.theme'),
       )));
     $this->extensionDiscovery->expects($this->at(1))
       ->method('scan')
       ->with('theme_engine')
       ->will($this->returnValue(array(
-        'twig' => new Extension('theme_engine', DRUPAL_ROOT . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'),
+        'twig' => new Extension($this->root, 'theme_engine', $this->root . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'),
       )));
     $this->infoParser->expects($this->once())
       ->method('parse')
-      ->with(DRUPAL_ROOT . '/core/themes/seven/seven.info.yml')
+      ->with($this->root . '/core/themes/seven/seven.info.yml')
       ->will($this->returnCallback(function ($file) {
         $info_parser = new InfoParser();
         return $info_parser->parse($file);
@@ -156,9 +164,9 @@ public function testRebuildThemeData() {
     // Ensure some basic properties.
     $this->assertInstanceOf('Drupal\Core\Extension\Extension', $info);
     $this->assertEquals('seven', $info->getName());
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/seven/seven.info.yml', $info->getPathname());
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/seven/seven.theme', $info->getExtensionPathname());
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine', $info->owner);
+    $this->assertEquals($this->root . '/core/themes/seven/seven.info.yml', $info->getPathname());
+    $this->assertEquals($this->root . '/core/themes/seven/seven.theme', $info->getExtensionPathname());
+    $this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info->owner);
     $this->assertEquals('twig', $info->prefix);
 
     $this->assertEquals('twig', $info->info['engine']);
@@ -167,16 +175,16 @@ public function testRebuildThemeData() {
     // Ensure that the css paths are set with the proper prefix.
     $this->assertEquals(array(
       'screen' => array(
-        'css/seven.base.css' => DRUPAL_ROOT . '/core/themes/seven/css/seven.base.css',
-        'css/style.css' => DRUPAL_ROOT . '/core/themes/seven/css/style.css',
-        'css/layout.css' => DRUPAL_ROOT . '/core/themes/seven/css/layout.css',
-        'css/components/buttons.css' => DRUPAL_ROOT . '/core/themes/seven/css/components/buttons.css',
-        'css/components/buttons.theme.css' => DRUPAL_ROOT . '/core/themes/seven/css/components/buttons.theme.css',
-        'css/components/dropbutton.component.css' => DRUPAL_ROOT . '/core/themes/seven/css/components/dropbutton.component.css',
-        'css/components/tour.theme.css' => DRUPAL_ROOT . '/core/themes/seven/css/components/tour.theme.css',
+        'css/seven.base.css' => $this->root . '/core/themes/seven/css/seven.base.css',
+        'css/style.css' => $this->root . '/core/themes/seven/css/style.css',
+        'css/layout.css' => $this->root . '/core/themes/seven/css/layout.css',
+        'css/components/buttons.css' => $this->root . '/core/themes/seven/css/components/buttons.css',
+        'css/components/buttons.theme.css' => $this->root . '/core/themes/seven/css/components/buttons.theme.css',
+        'css/components/dropbutton.component.css' => $this->root . '/core/themes/seven/css/components/dropbutton.component.css',
+        'css/components/tour.theme.css' => $this->root . '/core/themes/seven/css/components/tour.theme.css',
       ),
     ), $info->info['stylesheets']);
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/seven/screenshot.png', $info->info['screenshot']);
+    $this->assertEquals($this->root . '/core/themes/seven/screenshot.png', $info->info['screenshot']);
   }
 
   /**
@@ -187,25 +195,25 @@ public function testRebuildThemeDataWithThemeParents() {
       ->method('scan')
       ->with('theme')
       ->will($this->returnValue(array(
-        'test_subtheme' => new Extension('theme', DRUPAL_ROOT . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml', 'test_subtheme.info.yml'),
-        'test_basetheme' => new Extension('theme', DRUPAL_ROOT . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml', 'test_basetheme.info.yml'),
+        'test_subtheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml', 'test_subtheme.info.yml'),
+        'test_basetheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml', 'test_basetheme.info.yml'),
       )));
     $this->extensionDiscovery->expects($this->at(1))
       ->method('scan')
       ->with('theme_engine')
       ->will($this->returnValue(array(
-        'twig' => new Extension('theme_engine', DRUPAL_ROOT . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'),
+        'twig' => new Extension($this->root, 'theme_engine', $this->root . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'),
       )));
     $this->infoParser->expects($this->at(0))
       ->method('parse')
-      ->with(DRUPAL_ROOT . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml')
+      ->with($this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml')
       ->will($this->returnCallback(function ($file) {
         $info_parser = new InfoParser();
         return $info_parser->parse($file);
       }));
     $this->infoParser->expects($this->at(1))
       ->method('parse')
-      ->with(DRUPAL_ROOT . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml')
+      ->with($this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml')
       ->will($this->returnCallback(function ($file) {
         $info_parser = new InfoParser();
         return $info_parser->parse($file);
@@ -230,9 +238,9 @@ public function testRebuildThemeDataWithThemeParents() {
     $info_subtheme->info['base theme'] = 'test_basetheme';
     $info_basetheme->sub_themes = array('test_subtheme');
 
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine', $info_basetheme->owner);
+    $this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_basetheme->owner);
     $this->assertEquals('twig', $info_basetheme->prefix);
-    $this->assertEquals(DRUPAL_ROOT . '/core/themes/engines/twig/twig.engine', $info_subtheme->owner);
+    $this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_subtheme->owner);
     $this->assertEquals('twig', $info_subtheme->prefix);
   }
 
@@ -373,8 +381,8 @@ protected function systemListReset() {
 if (!defined('DRUPAL_PHP_FUNCTION_PATTERN')) {
   define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');
 }
-if (!defined('DRUPAL_ROOT')) {
-  define('DRUPAL_ROOT', dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))));
+if (!defined('$this->root')) {
+  define('$this->root', dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))));
 }
 if (!defined('DRUPAL_MINIMUM_PHP')) {
   define('DRUPAL_MINIMUM_PHP', '5.3.10');
diff --git a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
index fe42e81..f5f4c4a 100644
--- a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
@@ -46,12 +46,20 @@ class RegistryTest extends UnitTestCase {
   protected $moduleHandler;
 
   /**
+   * The app root.
+   *
+   * @var string
+   */
+  protected $root;
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
     $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
     $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
     $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
 
     $this->setupTheme();
   }
@@ -96,7 +104,7 @@ public function testGetRegistryForModule() {
   }
 
   protected function setupTheme($theme_name = NULL) {
-    $this->registry = new TestRegistry($this->cache, $this->lock, $this->moduleHandler, $theme_name);
+    $this->registry = new TestRegistry($this->root, $this->cache, $this->lock, $this->moduleHandler, $theme_name);
   }
 
 }
