protected function WorkspaceIntegrationTest::flattenExpectedValues in Drupal 8
Same name and namespace in other branches
- 9 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 959
Class
- WorkspaceIntegrationTest
- Tests a complete deployment 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;
}