diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
index 4557e94..29e4d2a 100644
--- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php
+++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php
@@ -7,9 +7,19 @@
 
 namespace Drupal\Tests;
 
+use Drupal\Tests\UnitTestCase;
+
 /**
  * Tests Composer integration.
  *
+ * Currently, Drupal requires composer.json files to be in specific places so
+ * that we can test their validity and integrity. This test could fail if the
+ * shipped Drupal 8 file system is modified.
+ *
+ * You can run tests from PHPUnit with --exclude-group Composer in order to
+ * avoid these test fails. You can also add a dummy empty composer.json file:
+ * "{}" to your installation's root directory for other testing needs.
+ *
  * @group Composer
  */
 class ComposerIntegrationTest extends UnitTestCase {
@@ -42,30 +52,35 @@ protected function getErrorMessages() {
   /**
    * Gets the paths to the folders that contain the Composer integration.
    *
+   * Data provider for testComposerJson.
+   *
    * @return string[]
    *   The paths.
    */
-  protected function getPaths() {
+  public function composerJsonProvider() {
+    // Data provider functions are run before setUp(), so we have to determine
+    // DRUPAL_ROOT here.
+    $root = self::getRoot();
     return [
-      $this->root,
-      $this->root . '/core',
-      $this->root . '/core/lib/Drupal/Component/Gettext',
-      $this->root . '/core/lib/Drupal/Component/Plugin',
-      $this->root . '/core/lib/Drupal/Component/ProxyBuilder',
-      $this->root . '/core/lib/Drupal/Component/Utility',
+      [$root],
+      [$root . '/core'],
+      [$root . '/core/lib/Drupal/Component/Gettext'],
+      [$root . '/core/lib/Drupal/Component/Plugin'],
+      [$root . '/core/lib/Drupal/Component/ProxyBuilder'],
+      [$root . '/core/lib/Drupal/Component/Utility'],
     ];
   }
 
   /**
    * Tests composer.json.
+   *
+   * @dataProvider composerJsonProvider
    */
-  public function testComposerJson() {
-    foreach ($this->getPaths() as $path) {
-      $json = file_get_contents($path . '/composer.json');
+  public function testComposerJson($path) {
+    $json = file_get_contents($path . '/composer.json');
 
-      $result = json_decode($json);
-      $this->assertNotNull($result, $this->getErrorMessages()[json_last_error()]);
-    }
+    $result = json_decode($json);
+    $this->assertNotNull($result, $this->getErrorMessages()[json_last_error()]);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index f2c6f4c..b157ce6 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -49,7 +49,17 @@ protected function setUp() {
     // unit tests should not be relying on caches implicitly.
     FileCacheFactory::setConfiguration(['default' => ['class' => '\Drupal\Component\FileCache\NullFileCache']]);
 
-    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
+    $this->root = self::getRoot();
+  }
+
+  /**
+   * Finds the root path for the Drupal installation.
+   *
+   * @return string
+   *   Path to the root of the Drupal installation.
+   */
+  public static function getRoot() {
+    return dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
   }
 
   /**
