function WorkspacesUpdateTest::testWorkspaceParentField

Tests the addition of the workspace 'parent' field.

See also

workspaces_update_8802()

workspaces_post_update_update_deploy_form_display()

File

core/modules/workspaces/tests/src/Functional/Update/WorkspacesUpdateTest.php, line 117

Class

WorkspacesUpdateTest
Tests the upgrade path for the Workspaces module.

Namespace

Drupal\Tests\workspaces\Functional\Update

Code

public function testWorkspaceParentField() {
  $this->runUpdates();
  $this->assertNotEmpty(\Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('parent', 'workspace'));
  $stage = Workspace::load('stage');
  $this->assertTrue($stage->hasField('parent'));
  $this->assertTrue($stage->parent
    ->isEmpty());
  // Check that the 'parent' field is hidden in the Deploy form display.
  $form_display = EntityFormDisplay::load('workspace.workspace.deploy');
  $this->assertNull($form_display->getComponent('parent'));
}

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