You are here

public function ConfigDeleteUITest::testConfigDeletionWithDependencies in Config Delete 8

Tests config delete with dependencies.

File

tests/src/Functional/ConfigDeleteUITest.php, line 76

Class

ConfigDeleteUITest
Tests the user interface for deleting configuration.

Namespace

Drupal\Tests\config_delete\Functional

Code

public function testConfigDeletionWithDependencies() {
  $config = $this
    ->config('config_delete_test.dep');
  $this
    ->assertEquals(13, $config
    ->get('id'));
  $config2 = $this
    ->config('config_delete_test.dep2');
  $this
    ->assertEquals(4, $config2
    ->get('id'));
  $config3 = $this
    ->config('config_delete_test.dep3');
  $this
    ->assertEquals(1984, $config3
    ->get('id'));
  $form_values = [
    'config_type' => 'system.simple',
    'config_name' => 'config_delete_test.dep',
    'delete_dependencies' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/config/development/configuration/delete', $form_values, 'Delete');
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Configuration "config_delete_test.dep" and all its dependencies successfully deleted.'));
  $config = $this
    ->config('config_delete_test.dep');
  $this
    ->assertNull($config
    ->get('id'));
  $config2 = $this
    ->config('config_delete_test.dep2');
  $this
    ->assertNull($config2
    ->get('id'));
  $config3 = $this
    ->config('config_delete_test.dep3');
  $this
    ->assertNull($config3
    ->get('id'));
}