protected function WorkspaceIntegrationTest::assertWorkspaceAssociation in Workspace 8.2
Checks the workspace_association entries 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.
1 call to WorkspaceIntegrationTest::assertWorkspaceAssociation()
- WorkspaceIntegrationTest::testWorkspaces in tests/
src/ Kernel/ WorkspaceIntegrationTest.php - Tests various scenarios for creating and deploying content in workspaces.
File
- tests/
src/ Kernel/ WorkspaceIntegrationTest.php, line 628
Class
- WorkspaceIntegrationTest
- Tests a complete deployment scenario across different workspaces.
Namespace
Drupal\Tests\workspace\KernelCode
protected function assertWorkspaceAssociation(array $expected, $entity_type_id) {
/** @var \Drupal\workspace\WorkspaceAssociationStorageInterface $workspace_association_storage */
$workspace_association_storage = $this->entityTypeManager
->getStorage('workspace_association');
foreach ($expected as $workspace_id => $expected_tracked_revision_ids) {
$tracked_entities = $workspace_association_storage
->getTrackedEntities($workspace_id, TRUE);
$tracked_revision_ids = isset($tracked_entities[$entity_type_id]) ? $tracked_entities[$entity_type_id] : [];
$this
->assertEquals($expected_tracked_revision_ids, array_keys($tracked_revision_ids));
}
}