assertYamlEdit example

$original_data = \Drupal::config($config_name)->get();

    // Change a configuration value in sync.     $sync_data = $original_data;
    $sync_data[$change_key] = $change_data;
    $sync_data[$add_key] = $add_data;
    $sync->write($config_name$sync_data);

    // Verify that the diff reflects a change.     $diff = \Drupal::service('config.manager')->diff($active$sync$config_name);
    $edits = $diff->getEdits();
    $this->assertYamlEdit($edits$change_key, 'change',
      [$change_key . ': ' . $original_data[$change_key]],
      [$change_key . ': ' . $change_data]);

    // Reset data back to original, and remove a key     $sync_data = $original_data;
    unset($sync_data[$remove_key]);
    $sync->write($config_name$sync_data);

    // Verify that the diff reflects a removed key.     $diff = \Drupal::service('config.manager')->diff($active$sync$config_name);
    $edits = $diff->getEdits();
    
Home | Imprint | This part of the site doesn't use cookies.