Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / block_content / tests / src / Functional / Update / BlockContentUpdateTest.php
index 804bf386791dae481d19b15e5c31f97a01f45529..f2653b72f71c582efa8c5cbc337310ed3183186c 100644 (file)
@@ -43,4 +43,27 @@ class BlockContentUpdateTest extends UpdatePathTestBase {
     $this->assertEqual('block_content_field_revision', $entity_type->getRevisionDataTable());
   }
 
+  /**
+   * Tests adding a status field to the block content entity type.
+   *
+   * @see block_content_update_8400()
+   */
+  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'));
+  }
+
 }