public function PermissionsByTermDrupalSubContext::createVocabulary in Permissions by Term 8.2
@Given /^I create vocabulary with name "([^"]*)" and vid "([^"]*)"$/
File
- tests/
src/ Behat/ Context/ permissions_by_term.behat.inc, line 64
Class
- PermissionsByTermDrupalSubContext
- Class PermissionsByTermContext
Namespace
Drupal\Tests\permissions_by_term\Behat\PermissionsByTermDrupalSubContextCode
public function createVocabulary($name, $vid) {
$vocabulary = \Drupal::entityQuery('taxonomy_vocabulary')
->condition('vid', $vid)
->execute();
if (empty($vocabulary)) {
$vocabulary = Vocabulary::create([
'name' => $name,
'vid' => $vid,
]);
$vocabulary
->save();
}
}