function BlockContentUpdateTest::testStatusFieldAddition

Tests adding a status field to the block content entity type.

See also

block_content_update_8400()

File

core/modules/block_content/tests/src/Functional/Update/BlockContentUpdateTest.php, line 52

Class

BlockContentUpdateTest
Tests update functions for the Block Content module.

Namespace

Drupal\Tests\block_content\Functional\Update

Code

public function testStatusFieldAddition() {
  $schema = \Drupal::database()->schema();
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  // Run updates.
  $this->runUpdates();
  // Check that the field exists and has the correct label.
  $updated_field = $entity_definition_update_manager->getFieldStorageDefinition('status', 'block_content');
  $this->assertEqual('Publishing status', $updated_field->getLabel());
  $content_translation_status = $entity_definition_update_manager->getFieldStorageDefinition('content_translation_status', 'block_content');
  $this->assertNull($content_translation_status);
  $this->assertFalse($schema->fieldExists('block_content_field_revision', 'content_translation_status'));
  $this->assertFalse($schema->fieldExists('block_content_field_data', 'content_translation_status'));
}

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