You are here

private function FixturesDataTrait::createVocabulary in Acquia Lift Connector 8.4

Returns a new vocabulary with random properties.

1 call to FixturesDataTrait::createVocabulary()
SettingsTest::setUp in tests/src/Functional/SettingsTest.php

File

tests/src/Unit/Traits/FixturesDataTrait.php, line 18

Class

FixturesDataTrait
Fixtures Data Trait.

Namespace

Drupal\Tests\acquia_lift\Unit\Traits

Code

private function createVocabulary() {

  // Create a vocabulary.
  $vocabulary = Vocabulary::create([
    'name' => $this
      ->randomMachineName(),
    'description' => $this
      ->randomMachineName(),
    'vid' => mb_strtolower($this
      ->randomMachineName()),
    'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'weight' => mt_rand(0, 10),
  ]);
  $vocabulary
    ->save();
  return $vocabulary;
}