function NodeStorageBodyFieldTest::testBackwardsCompatibility

Tests the BC coverage for node_storage_body_field.

File

core/modules/node/modules/node_storage_body_field/tests/src/Functional/NodeStorageBodyFieldTest.php, line 33

Class

NodeStorageBodyFieldTest
Tests the node_storage_body_field deprecated module.

Namespace

Drupal\Tests\node_storage_body_field\Functional

Code

public function testBackwardsCompatibility() : void {
  // Verify storage does not exist.
  $this->assertNull(FieldStorageConfig::load('node.body'));
  // Now install the BC module.
  \Drupal::service('module_installer')->install([
    'node_storage_body_field_test',
  ]);
  // Verify storage exists.
  $this->assertNotNull(FieldStorageConfig::load('node.body'));
  // Verify field exists.
  $this->assertNotNull(FieldConfig::load('node.article.body'));
  // Now uninstall node_storage_body_field_test.
  $this->container
    ->get('module_installer')
    ->uninstall([
    'node_storage_body_field_test',
  ]);
  // Verify again storage exists.
  $this->assertNotNull(FieldStorageConfig::load('node.body'));
  // Verify again field exists.
  $this->assertNotNull(FieldConfig::load('node.article.body'));
}

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