Chris@0: getEdits() as $op) { Chris@0: switch (get_class($op)) { Chris@0: case 'Drupal\Component\Diff\Engine\DiffOpCopy': Chris@0: // Nothing to do, a copy is what we expect. Chris@0: break; Chris@0: case 'Drupal\Component\Diff\Engine\DiffOpDelete': Chris@0: case 'Drupal\Component\Diff\Engine\DiffOpChange': Chris@0: // It is not part of the skipped config, so we can directly throw the Chris@0: // exception. Chris@0: if (!in_array($config_name, array_keys($skipped_config))) { Chris@0: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); Chris@0: } Chris@0: Chris@0: // Allow to skip entire config files. Chris@0: if ($skipped_config[$config_name] === TRUE) { Chris@17: break; Chris@0: } Chris@0: Chris@0: // Allow to skip some specific lines of imported config files. Chris@0: // Ensure that the only changed lines are the ones we marked as Chris@0: // skipped. Chris@0: $all_skipped = TRUE; Chris@0: Chris@0: $changes = get_class($op) == 'Drupal\Component\Diff\Engine\DiffOpDelete' ? $op->orig : $op->closing; Chris@0: foreach ($changes as $closing) { Chris@0: // Skip some of the changes, as they are caused by module install Chris@0: // code. Chris@0: $found = FALSE; Chris@0: if (!empty($skipped_config[$config_name])) { Chris@0: foreach ($skipped_config[$config_name] as $line) { Chris@0: if (strpos($closing, $line) !== FALSE) { Chris@0: $found = TRUE; Chris@0: break; Chris@0: } Chris@0: } Chris@0: } Chris@0: $all_skipped = $all_skipped && $found; Chris@0: } Chris@0: Chris@0: if (!$all_skipped) { Chris@0: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); Chris@0: } Chris@0: break; Chris@0: case 'Drupal\Component\Diff\Engine\DiffOpAdd': Chris@0: // The _core property does not exist in the default config. Chris@0: if ($op->closing[0] === '_core:') { Chris@17: break; Chris@0: } Chris@0: foreach ($op->closing as $closing) { Chris@0: // The UUIDs don't exist in the default config. Chris@0: if (strpos($closing, 'uuid: ') === 0) { Chris@17: break; Chris@0: } Chris@0: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); Chris@0: } Chris@0: break; Chris@0: default: Chris@0: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: }