You are here

public function UpdaterTest::testOnlyDeleteUpdate in Update helper 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/UpdaterTest.php \Drupal\Tests\update_helper\Kernel\UpdaterTest::testOnlyDeleteUpdate()

Test issue with using delete action without expected.

File

tests/src/Kernel/UpdaterTest.php, line 222

Class

UpdaterTest
@covers \Drupal\update_helper\Updater

Namespace

Drupal\Tests\update_helper\Kernel

Code

public function testOnlyDeleteUpdate() {

  /** @var \Drupal\config_update\ConfigRevertInterface $config_reverter */
  $config_reverter = \Drupal::service('config_update.config_update');
  $config_reverter
    ->import('field_storage_config', 'node.body');
  $config = $this
    ->config('field.storage.node.body');
  $expected_config_data = $config
    ->get();
  $config_data = $expected_config_data;
  $config_data['lost_config'] = 'text';
  $config
    ->setData($config_data)
    ->save(TRUE);

  /** @var \Drupal\update_helper\Updater $update_helper */
  $update_helper = \Drupal::service('update_helper.updater');

  // Ensure that configuration had new values.
  $this
    ->assertEquals('text', $this
    ->config('field.storage.node.body')
    ->get('lost_config'));

  // Execute update and validate new state.
  $update_helper
    ->executeUpdate('update_helper', 'test_updater_only_delete');
  $this
    ->assertEquals($expected_config_data, $this
    ->config('field.storage.node.body')
    ->get());
}