function WorkspaceInformationTest::testIgnoredEntityTypes
Same name in other branches
- 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceInformationTest::testIgnoredEntityTypes()
Tests ignored entity types.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceInformationTest.php, line 138
Class
- WorkspaceInformationTest
- Tests the workspace information service.
Namespace
Drupal\Tests\workspaces\KernelCode
public function testIgnoredEntityTypes() : void {
$entity_type = clone $this->entityTypeManager
->getDefinition('entity_test_rev');
$entity_type->setHandlerClass('workspace', IgnoredWorkspaceHandler::class);
$this->state
->set('entity_test_rev.entity_type', $entity_type);
$this->entityTypeManager
->clearCachedDefinitions();
// Check an ignored entity type. CRUD operations for an ignored entity type
// are allowed in a workspace, but their revisions are not tracked.
$entity = $this->entityTypeManager
->getStorage('entity_test_rev')
->create();
$this->assertTrue($this->workspaceInformation
->isEntityIgnored($entity));
$this->assertTrue($this->workspaceInformation
->isEntityTypeIgnored($entity->getEntityType()));
$this->assertFalse($this->workspaceInformation
->isEntitySupported($entity));
$this->assertFalse($this->workspaceInformation
->isEntityTypeSupported($entity->getEntityType()));
// Check that ignored entity types are not tracked in a workspace.
$entity->save();
$this->assertWorkspaceAssociation([
'stage' => [],
], 'entity_test_rev');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.