protected function ExportTest::createTaxonomyVocabulary in Acquia Content Hub 8.2
Creates a sample taxonomy vocabulary.
Parameters
int $items_expected: Expected number of items in the queue.
array $cdf_expectations: The sets of expectation arguments for CDF object validation.
Throws
\Drupal\Core\Entity\EntityStorageException
2 calls to ExportTest::createTaxonomyVocabulary()
- ExportTest::testPublishing in tests/src/ Kernel/ ExportTest.php 
- Tests Acquia ContentHub content/configuration export.
- ExportTest::testQueue in tests/src/ Kernel/ ExportTest.php 
- Tests Acquia ContentHub export queue.
File
- tests/src/ Kernel/ ExportTest.php, line 764 
Class
- ExportTest
- Tests entity exports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
protected function createTaxonomyVocabulary(&$items_expected, array &$cdf_expectations = []) {
  $name1 = $this
    ->randomString();
  $vid1 = $this
    ->randomMachineName();
  $description1 = $this
    ->randomString(128);
  $weight1 = rand(-100, 100);
  $vocabulary1 = Vocabulary::create([
    'name' => $name1,
    'vid' => $vid1,
    'description' => $description1,
    'weight' => $weight1,
  ]);
  $vocabulary1
    ->save();
  $this->vocabularyUuids[] = $vocabulary1
    ->uuid();
  $name2 = $this
    ->randomString();
  $description2 = $this
    ->randomString(128);
  $weight2 = rand(-100, 100);
  $vocabulary2 = Vocabulary::create([
    'name' => $name2,
    'vid' => 'test_vocabulary',
    'description' => $description2,
    'weight' => $weight2,
  ]);
  $vocabulary2
    ->save();
  $this->vocabularyUuids[] = $vocabulary2
    ->uuid();
  $items_expected = 2;
  $cdf_expectations = [
    [
      $vid1,
      $name1,
      $description1,
      $weight1,
    ],
    [
      'test_vocabulary',
      $name2,
      $description2,
      $weight2,
    ],
  ];
}