private function TermMatcherTest::createVocabulary in Linkit 8.4
Creates and saves a vocabulary.
Parameters
string $name: The vocabulary name.
Return value
Vocabulary The new vocabulary object. The new vocabulary object.
1 call to TermMatcherTest::createVocabulary()
- TermMatcherTest::setUp in src/
Tests/ Matchers/ TermMatcherTest.php - Sets up a Drupal site for running functional and integration tests.
File
- src/
Tests/ Matchers/ TermMatcherTest.php, line 45 - Contains \Drupal\linkit\Tests\Matchers\TermMatcherTest.
Class
- TermMatcherTest
- Tests term matcher.
Namespace
Drupal\linkit\Tests\MatchersCode
private function createVocabulary($name) {
$vocabularyStorage = \Drupal::entityTypeManager()
->getStorage('taxonomy_vocabulary');
$vocabulary = $vocabularyStorage
->create([
'name' => $name,
'description' => $name,
'vid' => Unicode::strtolower($name),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
$vocabulary
->save();
return $vocabulary;
}