function StubTestTrait::validateStub
Same name in other branches
- 9 core/modules/migrate_drupal/src/Tests/StubTestTrait.php \Drupal\migrate_drupal\Tests\StubTestTrait::validateStub()
- 8.9.x core/modules/migrate_drupal/src/Tests/StubTestTrait.php \Drupal\migrate_drupal\Tests\StubTestTrait::validateStub()
- 11.x core/modules/migrate_drupal/src/Tests/StubTestTrait.php \Drupal\migrate_drupal\Tests\StubTestTrait::validateStub()
Perform validation on a stub entity.
Parameters
string $entity_type_id: The entity type we are stubbing.
string $entity_id: ID of the stubbed entity to validate.
Return value
\Drupal\Core\Entity\EntityConstraintViolationListInterface List of constraint violations identified.
1 call to StubTestTrait::validateStub()
- StubTestTrait::performStubTest in core/
modules/ migrate_drupal/ src/ Tests/ StubTestTrait.php - Tests that creating a stub of an entity type results in a valid entity.
File
-
core/
modules/ migrate_drupal/ src/ Tests/ StubTestTrait.php, line 60
Class
- StubTestTrait
- Provides common functionality for testing stubbing.
Namespace
Drupal\migrate_drupal\TestsCode
protected function validateStub($entity_type_id, $entity_id) {
$controller = \Drupal::entityTypeManager()->getStorage($entity_type_id);
/** @var \Drupal\Core\Entity\ContentEntityInterface $stub_entity */
$stub_entity = $controller->load($entity_id);
return $stub_entity->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.