protected function PreExistingTermImportExportTest::setUp in Acquia Content Hub 8.2
Throws
\Exception
Overrides ImportExportTestBase::setUp
File
- tests/
src/ Kernel/ PreExistingTermImportExportTest.php, line 47
Class
- PreExistingTermImportExportTest
- Tests preexisting entity export and imports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('user');
$this
->installSchema('user', [
'users_data',
]);
$this
->installEntitySchema('node');
$this
->installEntitySchema('taxonomy_term');
$this
->installSchema('acquia_contenthub_subscriber', 'acquia_contenthub_subscriber_import_tracking');
$values0 = [
'langcode' => 'en',
'status' => TRUE,
'name' => 'Category',
'vid' => 'category',
'description' => 'Category',
'hierarchy' => 1,
'weight' => 0,
];
$vocab = $this->entityTypeManager
->getStorage('taxonomy_vocabulary')
->create($values0);
$vocab
->save();
$values1 = [
'name' => 'Category 1',
'vid' => $vocab
->id(),
];
$term1 = $this->entityTypeManager
->getStorage('taxonomy_term')
->create($values1);
$term1
->save();
$values2 = [
'name' => 'Category 1 - 1',
'vid' => $vocab
->id(),
'parent' => $term1
->id(),
];
$term2 = $this->entityTypeManager
->getStorage('taxonomy_term')
->create($values2);
$term2
->save();
$values3 = [
'name' => 'Category 1 - 1 - 1',
'vid' => $vocab
->id(),
'parent' => $term2
->id(),
];
$term3 = $this->entityTypeManager
->getStorage('taxonomy_term')
->create($values3);
$term3
->save();
$this->terms = [
$term1,
$term2,
$term3,
];
}