function WorkspaceTestTrait::assertWorkspaceAssociation
Same name in other branches
- 9 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::assertWorkspaceAssociation()
- 8.9.x core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::assertWorkspaceAssociation()
- 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::assertWorkspaceAssociation()
Checks the workspace_association records for a test scenario.
Parameters
array $expected: An array of expected values, as defined in ::testWorkspaces().
string $entity_type_id: The ID of the entity type that is being tested.
7 calls to WorkspaceTestTrait::assertWorkspaceAssociation()
- WorkspaceInformationTest::testCustomSupportEntityTypes in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceInformationTest.php - Tests an entity type with a custom workspace handler.
- WorkspaceInformationTest::testIgnoredEntityTypes in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceInformationTest.php - Tests ignored entity types.
- WorkspaceInformationTest::testSupportedEntityTypes in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceInformationTest.php - Tests fully supported entity types.
- WorkspaceIntegrationTest::testWorkspaceAssociationDataIntegrity in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Tests the workspace association data integrity for entity CRUD operations.
- WorkspaceIntegrationTest::testWorkspaceHierarchy in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Tests entity tracking in workspace descendants.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceTestTrait.php, line 114
Class
- WorkspaceTestTrait
- A trait with common workspaces testing functionality.
Namespace
Drupal\Tests\workspaces\KernelCode
protected function assertWorkspaceAssociation(array $expected, $entity_type_id) {
/** @var \Drupal\workspaces\WorkspaceAssociationInterface $workspace_association */
$workspace_association = \Drupal::service('workspaces.association');
foreach ($expected as $workspace_id => $expected_tracked_revision_ids) {
$tracked_entities = $workspace_association->getTrackedEntities($workspace_id, $entity_type_id);
$tracked_revision_ids = $tracked_entities[$entity_type_id] ?? [];
$this->assertEquals($expected_tracked_revision_ids, array_keys($tracked_revision_ids));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.