You are here

protected function PreExistingTermMultipleParentImportExportTest::setUp in Acquia Content Hub 8.2

Throws

\Exception

Overrides ImportExportTestBase::setUp

File

tests/src/Kernel/PreExistingTermMultipleParentImportExportTest.php, line 54

Class

PreExistingTermMultipleParentImportExportTest
Tests terms with multiple parents during export and import.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->installSchema('acquia_contenthub_subscriber', 'acquia_contenthub_subscriber_import_tracking');
  $values00 = [
    'langcode' => 'en',
    'status' => TRUE,
    'name' => 'Category',
    'vid' => 'category',
    'description' => 'Category',
    'hierarchy' => 1,
    'weight' => 0,
  ];
  $vocab = $this->entityTypeManager
    ->getStorage('taxonomy_vocabulary')
    ->create($values00);
  $vocab
    ->save();
  $values0 = [
    'name' => 'Category 1',
    'vid' => $vocab
      ->id(),
    'parent' => [],
  ];
  $values1 = [
    'name' => 'Category 1 - 1',
    'vid' => $vocab
      ->id(),
    'parent' => [
      0,
    ],
  ];
  $values2 = [
    'name' => 'Category 2',
    'vid' => $vocab
      ->id(),
    'parent' => [],
  ];
  $values3 = [
    'name' => 'Category 2 - 1',
    'vid' => $vocab
      ->id(),
    'parent' => [
      2,
    ],
  ];
  $values4 = [
    'name' => 'Category Mixed',
    'vid' => $vocab
      ->id(),
    'parent' => [
      1,
      3,
    ],
  ];
  $this->termValues = [
    0 => $values0,
    1 => $values1,
    2 => $values2,
    3 => $values3,
    4 => $values4,
  ];
}