function WorkspaceInformationTest::testUnsupportedEntityTypes
Same name in other branches
- 10 core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceInformationTest::testUnsupportedEntityTypes()
Tests unsupported entity types.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceInformationTest.php, line 161
Class
- WorkspaceInformationTest
- Tests the workspace information service.
Namespace
Drupal\Tests\workspaces\KernelCode
public function testUnsupportedEntityTypes() : void {
// Check an unsupported entity type.
$entity_test = $this->entityTypeManager
->getDefinition('entity_test');
$this->assertFalse($entity_test->hasHandlerClass('workspace'));
$entity = $this->entityTypeManager
->getStorage('entity_test')
->create();
$this->assertFalse($this->workspaceInformation
->isEntitySupported($entity));
$this->assertFalse($this->workspaceInformation
->isEntityTypeSupported($entity_test));
$this->assertFalse($this->workspaceInformation
->isEntityIgnored($entity));
$this->assertFalse($this->workspaceInformation
->isEntityTypeIgnored($entity_test));
// Check that unsupported entity types can not be saved in a workspace.
$this->expectException(EntityStorageException::class);
$this->expectExceptionMessage('This entity can only be saved in the default workspace.');
$entity->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.