Commit b759a939 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #3054582 by jeqq, blazey, Leksat, Gábor Hojtsy, larowlan, amateescu: Add...

Issue #3054582 by jeqq, blazey, Leksat, Gábor Hojtsy, larowlan, amateescu: Add field ui to workspaces
parent 8e31070e
......@@ -44,6 +44,7 @@
* 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",
......
......@@ -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 @@ public function testWorkspaceFormRevisions() {
$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);
}
}
entity.workspace.collection:
title: 'List'
route_name: entity.workspace.collection
base_route: entity.workspace.collection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment