function ViewsConfigDependenciesIntegrationTest::testConfigRemovalBaseTable

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php \Drupal\Tests\views\Kernel\ViewsConfigDependenciesIntegrationTest::testConfigRemovalBaseTable()
  2. 10 core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php \Drupal\Tests\views\Kernel\ViewsConfigDependenciesIntegrationTest::testConfigRemovalBaseTable()
  3. 11.x core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php \Drupal\Tests\views\Kernel\ViewsConfigDependenciesIntegrationTest::testConfigRemovalBaseTable()

Tests uninstalling a module that provides a base table for a View.

File

core/modules/views/tests/src/Kernel/ViewsConfigDependenciesIntegrationTest.php, line 151

Class

ViewsConfigDependenciesIntegrationTest
Tests integration of views with other modules.

Namespace

Drupal\Tests\views\Kernel

Code

public function testConfigRemovalBaseTable() {
    // Find all the entity types provided by the entity_test module and install
    // the schema for them so we can uninstall them.
    $entities = \Drupal::entityTypeManager()->getDefinitions();
    foreach ($entities as $entity_type_id => $definition) {
        if ($definition->getProvider() == 'entity_test') {
            $this->installEntitySchema($entity_type_id);
        }
    }
    // Check that removing the module that provides the base table for a View,
    // deletes the View.
    $this->assertNotNull(View::load('entity_test_fields'));
    $this->container
        ->get('module_installer')
        ->uninstall([
        'entity_test',
    ]);
    // Check that the View has been deleted.
    $this->assertNull(View::load('entity_test_fields'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.