You are here

public function FarmEntityBundleFieldTest::testBundlePluginModuleUninstallation in farmOS 2.x

Test that bundle fields can be reused across bundles.

File

modules/core/entity/tests/src/Functional/FarmEntityBundleFieldTest.php, line 108

Class

FarmEntityBundleFieldTest
Tests that bundle fields are created during a postponed install.

Namespace

Drupal\Tests\farm_entity\Functional

Code

public function testBundlePluginModuleUninstallation() {

  // Test that database tables exist after uninstalling a bundle with
  // a field storage definition used by other bundles.
  $this->moduleInstaller
    ->uninstall([
    'farm_entity_bundle_fields_test',
  ]);

  // Must clear the cache for the test environment.
  $this->entityFieldManager
    ->clearCachedFieldDefinitions();

  // Test that correct field storage definitions and database tables exist.
  $test_fields = [
    'second_plan_field' => FALSE,
    'asset' => TRUE,
    'log' => TRUE,
  ];
  foreach ($test_fields as $field_name => $exists) {
    $this
      ->assertFieldStorageDefinitionExists('plan', $field_name, $exists);
  }
}