protected function StubTestTrait::validateStub in Drupal 8
Same name and namespace in other branches
- 9 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 - Test that creating a stub of the given entity type results in a valid entity.
File
- core/
modules/ migrate_drupal/ src/ Tests/ StubTestTrait.php, line 61
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();
}