function RowTest::setUp
Overrides KernelTestBase::setUp
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ RowTest.php, line 50
Class
- RowTest
- Tests the Row class.
Namespace
Drupal\Tests\migrate\KernelCode
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('entity_test');
$this->eventDispatcher = \Drupal::service('event_dispatcher');
$this->entityTypeManager = \Drupal::service('entity_type.manager');
$this->migrationManager = \Drupal::service('plugin.manager.migration');
// Create two fields that will be set during migration.
$fields = [
'field1',
'field2',
];
foreach ($fields as $field) {
$this->entityTypeManager
->getStorage('field_storage_config')
->create([
'entity_type' => 'entity_test',
'field_name' => $field,
'type' => 'string',
])
->save();
$this->entityTypeManager
->getStorage('field_config')
->create([
'entity_type' => 'entity_test',
'field_name' => $field,
'bundle' => 'entity_test',
])
->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.