Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / config / tests / config_test / src / Entity / ConfigTest.php
index 1bd1d8dee9b7b732c70b0522fec3e14d346630b7..d1a7249bede978e8901c35524d7dfc98ef09fefe 100644 (file)
@@ -113,13 +113,27 @@ class ConfigTest extends ConfigEntityBase implements ConfigTestInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    parent::calculateDependencies();
+    if ($module = \Drupal::state()->get('config_test_new_dependency', FALSE)) {
+      $this->addDependency('module', $module);
+    }
+    return $this;
+  }
+
   /**
    * {@inheritdoc}
    */
   public function onDependencyRemoval(array $dependencies) {
-    // Record which entities have this method called on.
+    // Record which entities have this method called on and what dependencies
+    // are passed.
     $called = \Drupal::state()->get('config_test.on_dependency_removal_called', []);
-    $called[] = $this->id();
+    $called[$this->id()] = $dependencies;
+    $called[$this->id()]['config'] = array_keys($called[$this->id()]['config']);
+    $called[$this->id()]['content'] = array_keys($called[$this->id()]['content']);
     \Drupal::state()->set('config_test.on_dependency_removal_called', $called);
 
     $changed = parent::onDependencyRemoval($dependencies);