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 / ConfigValidation.php
index 9c6939432ed5fe516ec41d8530950fb93bcca3be..afb86c34c9fc7d5b8539216174a354a92383af7f 100644 (file)
@@ -74,8 +74,11 @@ class ConfigValidation {
    *   The validation execution context.
    */
   public static function validateMapping($mapping, ExecutionContextInterface $context) {
-    if ($diff = array_diff(array_keys($mapping), ['llama', 'cat', 'giraffe', 'uuid', '_core'])) {
-      $context->addViolation('Missing giraffe.');
+    // Ensure we are validating the entire mapping by diffing against all the
+    // keys.
+    $mapping_schema = \Drupal::service('config.typed')->get('config_test.validation')->getValue();
+    if ($diff = array_diff_key($mapping, $mapping_schema)) {
+      $context->addViolation('Unexpected keys: ' . implode(', ', array_keys($diff)));
     }
   }