protected function EntityGenerateTest::setUp in Migrate Plus 8.5
Same name and namespace in other branches
- 8.3 tests/src/Kernel/Plugin/migrate/process/EntityGenerateTest.php \Drupal\Tests\migrate_plus\Kernel\Plugin\migrate\process\EntityGenerateTest::setUp()
- 8.4 tests/src/Kernel/Plugin/migrate/process/EntityGenerateTest.php \Drupal\Tests\migrate_plus\Kernel\Plugin\migrate\process\EntityGenerateTest::setUp()
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ Plugin/ migrate/ process/ EntityGenerateTest.php, line 74
Class
- EntityGenerateTest
- Tests the migration plugin.
Namespace
Drupal\Tests\migrate_plus\Kernel\Plugin\migrate\processCode
protected function setUp() : void {
parent::setUp();
// Create article content type.
$values = [
'type' => $this->bundle,
'name' => 'Page',
];
$node_type = NodeType::create($values);
$node_type
->save();
$this
->installEntitySchema('node');
$this
->installEntitySchema('taxonomy_term');
$this
->installEntitySchema('taxonomy_vocabulary');
$this
->installEntitySchema('user');
$this
->installSchema('system', [
'sequences',
]);
$this
->installSchema('user', 'users_data');
$this
->installConfig(self::$modules);
// Create a vocabulary.
$vocabulary = Vocabulary::create([
'name' => $this->vocabulary,
'description' => $this->vocabulary,
'vid' => $this->vocabulary,
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
$vocabulary
->save();
// Create a field.
$this
->createEntityReferenceField('node', $this->bundle, $this->fieldName, 'Term reference', 'taxonomy_term', 'default', [
'target_bundles' => [
$this->vocabulary,
],
], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
// Create a non-reference field.
FieldStorageConfig::create([
'field_name' => 'field_integer',
'type' => 'integer',
'entity_type' => 'node',
])
->save();
FieldConfig::create([
'field_name' => 'field_integer',
'entity_type' => 'node',
'bundle' => $this->bundle,
])
->save();
$this->migrationPluginManager = \Drupal::service('plugin.manager.migration');
}