You are here

protected function ConfigSnapshotStorageTest::delete in Config Snapshot 8

Overrides ConfigStorageTestBase::delete

File

tests/src/Kernel/ConfigSnapshotStorageTest.php, line 80

Class

ConfigSnapshotStorageTest
Tests ConfigSnapshotStorage operations.

Namespace

Drupal\Tests\config_snapshot\Kernel

Code

protected function delete($name) {

  /* @var \Drupal\config_snapshot\Entity\ConfigSnapshot $config_snapshot */
  $config_snapshot = ConfigSnapshot::load('example.module.example_module');

  // Check first if the name to delete exists.
  if ($this->storage
    ->exists($name)) {
    $config_snapshot
      ->clearItem($this->storage
      ->getCollectionName(), $name)
      ->save();
    return TRUE;
  }
  return FALSE;
}