Issue #3054582 by jeqq, blazey, Leksat, Gábor Hojtsy, larowlan, amateescu: Add field ui to workspaces

merge-requests/1119/head
Gábor Hojtsy 2019-06-13 14:20:34 +03:00
parent 8e31070ea3
commit b759a939d6
3 changed files with 45 additions and 1 deletions

View File

@ -44,6 +44,7 @@ use Drupal\workspaces\WorkspaceInterface;
* revision_table = "workspace_revision",
* data_table = "workspace_field_data",
* revision_data_table = "workspace_field_revision",
* field_ui_base_route = "entity.workspace.collection",
* entity_keys = {
* "id" = "id",
* "revision" = "revision_id",

View File

@ -16,7 +16,7 @@ class WorkspaceTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['workspaces', 'toolbar'];
public static $modules = ['workspaces', 'toolbar', 'field_ui'];
/**
* A test user.
@ -141,4 +141,43 @@ class WorkspaceTest extends BrowserTestBase {
$this->assertEquals('3', $live_workspace->getRevisionId());
}
/**
* Tests adding new fields to workspace entities.
*/
public function testWorkspaceFieldUi() {
$user = $this->drupalCreateUser([
'administer workspaces',
'access administration pages',
'administer site configuration',
'administer workspace fields',
'administer workspace display',
'administer workspace form display',
]);
$this->drupalLogin($user);
$this->drupalGet('admin/config/workflow/workspaces/fields');
$this->assertSession()->statusCodeEquals(200);
// Create a new filed.
$field_name = mb_strtolower($this->randomMachineName());
$field_label = $this->randomMachineName();
$edit = [
'new_storage_type' => 'string',
'label' => $field_label,
'field_name' => $field_name,
];
$this->drupalPostForm("admin/config/workflow/workspaces/fields/add-field", $edit, 'Save and continue');
$page = $this->getSession()->getPage();
$page->pressButton('Save field settings');
$page->pressButton('Save settings');
// Check that the field is displayed on the manage form display page.
$this->drupalGet('admin/config/workflow/workspaces/form-display');
$this->assertText($field_label);
// Check that the field is displayed on the manage display page.
$this->drupalGet('admin/config/workflow/workspaces/display');
$this->assertText($field_label);
}
}

View File

@ -0,0 +1,4 @@
entity.workspace.collection:
title: 'List'
route_name: entity.workspace.collection
base_route: entity.workspace.collection