public function PermissionsByTermContext::createVocabulary in Permissions by Term 8
@Given /^I create vocabulary with name "([^"]*)" and vid "([^"]*)"$/
File
- tests/
src/ Behat/ Context/ PermissionsByTermContext.php, line 64
Class
- PermissionsByTermContext
- Class PermissionsByTermContext
Namespace
Drupal\Tests\permissions_by_term\Behat\ContextCode
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();
}
}