function WorkspaceTestTrait::ignoreEntityType

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::ignoreEntityType()

Marks an entity type as ignored in a workspace.

Parameters

string $entity_type_id: The entity type ID.

1 call to WorkspaceTestTrait::ignoreEntityType()
WorkspacesFileItemTest::testFileItem in core/modules/workspaces/tests/src/Kernel/WorkspacesFileItemTest.php
Tests using entity fields of the file field type.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php, line 159

Class

WorkspaceTestTrait
A trait with common workspaces testing functionality.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function ignoreEntityType(string $entity_type_id) : void {
    $entity_type = clone \Drupal::entityTypeManager()->getDefinition($entity_type_id);
    $entity_type->setHandlerClass('workspace', IgnoredWorkspaceHandler::class);
    \Drupal::state()->set("{$entity_type_id}.entity_type", $entity_type);
    \Drupal::entityTypeManager()->clearCachedDefinitions();
}

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