private function EntityGenerateTest::createTestData in Migrate Plus 8.5
Same name and namespace in other branches
- 8.4 tests/src/Kernel/Plugin/migrate/process/EntityGenerateTest.php \Drupal\Tests\migrate_plus\Kernel\Plugin\migrate\process\EntityGenerateTest::createTestData()
Create pre-seed test data.
Parameters
string $storageName: The storage manager to create.
array $values: The values to use when creating the entity.
Return value
string|int The entity identifier.
2 calls to EntityGenerateTest::createTestData()
- EntityGenerateTest::testNonReferenceField in tests/
src/ Kernel/ Plugin/ migrate/ process/ EntityGenerateTest.php - Test lookup without a reference field.
- EntityGenerateTest::testTransform in tests/
src/ Kernel/ Plugin/ migrate/ process/ EntityGenerateTest.php - Tests generating an entity.
File
- tests/
src/ Kernel/ Plugin/ migrate/ process/ EntityGenerateTest.php, line 983
Class
- EntityGenerateTest
- Tests the migration plugin.
Namespace
Drupal\Tests\migrate_plus\Kernel\Plugin\migrate\processCode
private function createTestData($storageName, array $values) {
/** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
$storage = $this->container
->get('entity_type.manager')
->getStorage($storageName);
$entity = $storage
->create($values);
$entity
->save();
return $entity
->id();
}