protected function MonitoringCoreWebTest::createTerm in Monitoring 8
Returns a new term with random properties in vocabulary $vid.
Parameters
\Drupal\taxonomy\VocabularyInterface $vocabulary: The vocabulary where the term will belong to.
Return value
\Drupal\taxonomy\TermInterface; Term object.
1 call to MonitoringCoreWebTest::createTerm()
- MonitoringCoreWebTest::testEntityAggregator in tests/
src/ Functional/ MonitoringCoreWebTest.php - Tests the entity aggregator.
File
- tests/
src/ Functional/ MonitoringCoreWebTest.php, line 920
Class
- MonitoringCoreWebTest
- Integration tests for the core pieces of monitoring.
Namespace
Drupal\Tests\monitoring\FunctionalCode
protected function createTerm($vocabulary) {
$term = Term::create(array(
'vid' => $vocabulary
->id(),
));
$term->name = $this
->randomMachineName();
$term->description = $this
->randomMachineName();
$term
->save();
return $term;
}