function WorkspaceInformationTest::testSupportedEntityTypes

Same name and namespace in other branches
  1. 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceInformationTest::testSupportedEntityTypes()

Tests fully supported entity types.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php, line 82

Class

WorkspaceInformationTest
Tests the workspace information service.

Namespace

Drupal\Tests\workspaces\Kernel

Code

public function testSupportedEntityTypes() : void {
  // Check a supported entity type.
  $entity = $this->entityTypeManager
    ->getStorage('entity_test_revpub')
    ->create();
  $this->assertTrue($this->workspaceInformation
    ->isEntitySupported($entity));
  $this->assertTrue($this->workspaceInformation
    ->isEntityTypeSupported($entity->getEntityType()));
  $this->assertFalse($this->workspaceInformation
    ->isEntityIgnored($entity));
  $this->assertFalse($this->workspaceInformation
    ->isEntityTypeIgnored($entity->getEntityType()));
  // Check that supported entity types are tracked in a workspace. This entity
  // is published by default, so the second revision will be tracked.
  $entity->save();
  $this->assertWorkspaceAssociation([
    'stage' => [
      2,
    ],
  ], 'entity_test_revpub');
}

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