Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Extension / ModuleExtensionListTest.php
diff --git a/web/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/web/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
new file mode 100644 (file)
index 0000000..dd5d13e
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Drupal\KernelTests\Core\Extension;
+
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Extension\ModuleExtensionList
+ * @group Extension
+ */
+class ModuleExtensionListTest extends KernelTestBase {
+
+  /**
+   * @covers ::getList
+   */
+  public function testGetlist() {
+    \Drupal::configFactory()->getEditable('core.extension')
+      ->set('module.testing', 1000)
+      ->set('profile', 'testing')
+      ->save();
+
+    // The installation profile is provided by a container parameter.
+    // Saving the configuration doesn't automatically trigger invalidation
+    $this->container->get('kernel')->rebuildContainer();
+
+    /** @var \Drupal\Core\Extension\ModuleExtensionList $module_extension_list */
+    $module_extension_list = \Drupal::service('extension.list.module');
+    $extensions = $module_extension_list->getList();
+
+    $this->assertArrayHasKey('testing', $extensions);
+    $this->assertEquals(1000, $extensions['testing']->weight);
+  }
+
+}