protected function MigrateUiParagraphsTestBase::assertEntities in Paragraphs 8
Asserts that the expected entities exist.
1 call to MigrateUiParagraphsTestBase::assertEntities()
- MigrateUiParagraphsTestBase::assertParagraphsMigrationResults in tests/
src/ Functional/ Migrate/ MigrateUiParagraphsTestBase.php - Checks that migrations have been performed successfully.
File
- tests/
src/ Functional/ Migrate/ MigrateUiParagraphsTestBase.php, line 501
Class
- MigrateUiParagraphsTestBase
- Provides a base class for testing Paragraphs migration via the UI.
Namespace
Drupal\Tests\paragraphs\Functional\MigrateCode
protected function assertEntities() {
foreach ($this
->getExpectedEntities() as $entity_type_id => $expected_entity_labels) {
if ($storage = $this
->getEntityStorage($entity_type_id)) {
$entities = $storage
->loadMultiple();
$actual_labels = array_reduce($entities, function ($carry, EntityInterface $entity) {
$carry[$entity
->id()] = (string) $entity
->label();
return $carry;
});
$this
->assertEquals($expected_entity_labels, $actual_labels, sprintf('The expected %s entities are not matching the actual ones.', $entity_type_id));
}
else {
$this
->fail(sprintf('The expected %s entity type is missing.', $entity_type_id));
}
}
}