function WorkspaceIntegrationTest::flattenExpectedValues
Same name in other branches
- 9 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::flattenExpectedValues()
- 8.9.x core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::flattenExpectedValues()
- 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::flattenExpectedValues()
Flattens the expectations array defined by testWorkspaces().
Parameters
array $expected: An array as defined by testWorkspaces().
string $entity_type_id: The ID of the entity type that is being tested.
Return value
array An array where all the entity IDs and revision IDs are merged inside each expected values array.
1 call to WorkspaceIntegrationTest::flattenExpectedValues()
- WorkspaceIntegrationTest::assertWorkspaceStatus in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Checks entity load, entity queries and views results for a test scenario.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php, line 1034
Class
- WorkspaceIntegrationTest
- Tests a complete publishing scenario across different workspaces.
Namespace
Drupal\Tests\workspaces\KernelCode
protected function flattenExpectedValues(array $expected, $entity_type_id) {
$flattened = [];
$entity_keys = $this->entityTypeManager
->getDefinition($entity_type_id)
->getKeys();
foreach ($expected as $workspace_id => $workspace_values) {
foreach ($workspace_values as $entity_id => $entity_revisions) {
foreach ($entity_revisions as $revision_id => $revision_values) {
$flattened[$workspace_id][] = [
$entity_keys['id'] => $entity_id,
$entity_keys['revision'] => $revision_id,
] + $revision_values;
}
}
}
return $flattened;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.