You are here

private function FixturesDataTrait::createVocabulary in Acquia Lift Connector 8

Same name and namespace in other branches
  1. 8.3 src/Tests/FixturesDataTrait.php \Drupal\acquia_lift\Tests\FixturesDataTrait::createVocabulary()

Returns a new vocabulary with random properties.

1 call to FixturesDataTrait::createVocabulary()
SettingsTest::setUp in src/Tests/SettingsTest.php
Sets up a Drupal site for running functional and integration tests.

File

src/Tests/FixturesDataTrait.php, line 24
Contains \Drupal\acquia_lift\Tests\FixturesDataTrait.

Class

FixturesDataTrait
Fixtures Data Trait.

Namespace

Drupal\acquia_lift\Tests

Code

private function createVocabulary() {

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