protected function WorkspaceIntegrationTest::assertEntityRevisionLoad in Workspace 8.2
Asserts that non-default revisions are not changed.
Parameters
array $expected_values: An array of expected values, as defined in ::testWorkspaces().
string $entity_type_id: The ID of the entity type to check.
1 call to WorkspaceIntegrationTest::assertEntityRevisionLoad()
- WorkspaceIntegrationTest::assertWorkspaceStatus in tests/
src/ Kernel/ WorkspaceIntegrationTest.php - Checks entity load, entity queries and views results for a test scenario.
File
- tests/
src/ Kernel/ WorkspaceIntegrationTest.php, line 550
Class
- WorkspaceIntegrationTest
- Tests a complete deployment scenario across different workspaces.
Namespace
Drupal\Tests\workspace\KernelCode
protected function assertEntityRevisionLoad(array $expected_values, $entity_type_id) {
$entity_keys = $this->entityTypeManager
->getDefinition($entity_type_id)
->getKeys();
$id_key = $entity_keys['id'];
$revision_key = $entity_keys['revision'];
$label_key = $entity_keys['label'];
$published_key = $entity_keys['published'];
/** @var \Drupal\Core\Entity\EntityInterface[]|\Drupal\Core\Entity\RevisionableInterface[]|\Drupal\Core\Entity\EntityPublishedInterface[] $entities */
$entities = $this->entityTypeManager
->getStorage($entity_type_id)
->loadMultipleRevisions(array_column($expected_values, $revision_key));
foreach ($expected_values as $expected_revision) {
$revision_id = $expected_revision[$revision_key];
$this
->assertEquals($expected_revision[$id_key], $entities[$revision_id]
->id());
$this
->assertEquals($expected_revision[$revision_key], $entities[$revision_id]
->getRevisionId());
$this
->assertEquals($expected_revision[$label_key], $entities[$revision_id]
->label());
$this
->assertEquals($expected_revision[$published_key], $entities[$revision_id]
->isPublished());
}
}