Skip to content
Snippets Groups Projects
Unverified Commit afa2e320 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3044749 by amateescu, plach, Joseph Zhao: Drupal Core Update...

Issue #3044749 by amateescu, plach, Joseph Zhao: Drupal Core Update (8.7.0-beta1) - the "workspace" plugin does not exist

(cherry picked from commit 7b5d11ff)
parent db21b29a
No related branches found
No related tags found
No related merge requests found
......@@ -50,8 +50,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDescription(new TranslatableMarkup('The workspace of the referenced content.'))
->setSetting('target_type', 'workspace')
->setRequired(TRUE)
->setRevisionable(TRUE)
->addConstraint('workspace', []);
->setRevisionable(TRUE);
$fields['target_entity_type_id'] = BaseFieldDefinition::create('string')
->setLabel(new TranslatableMarkup('Content entity type ID'))
......
......@@ -7,6 +7,7 @@
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Drupal\workspaces\Entity\Workspace;
use Drupal\workspaces\Entity\WorkspaceAssociation;
/**
* Tests CRUD operations for workspaces.
......@@ -189,4 +190,28 @@ public function testDeletingWorkspaces() {
$this->assertCount(0, $workspace_deleted);
}
/**
* Tests workspace association validation.
*
* @covers \Drupal\workspaces\Entity\WorkspaceAssociation::validate
*/
public function testWorkspaceAssociationValidation() {
$workspace = Workspace::create([
'id' => 'gibbon',
'label' => 'Gibbon',
]);
$workspace->save();
$node = $this->createNode();
$workspace_association = WorkspaceAssociation::create([
'workspace' => $workspace,
'target_entity_type_id' => $node->getEntityTypeId(),
'target_entity_id' => $node->id(),
'target_entity_revision_id' => $node->getRevisionId(),
]);
$violations = $workspace_association->validate();
$this->assertCount(0, $violations);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment