function TaxonomyTestTrait::createTaxonomyTermRevision
Same name in other branches
- 11.x core/modules/taxonomy/tests/src/Traits/TaxonomyTestTrait.php \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait::createTaxonomyTermRevision()
Creates a new revision for a given taxonomy term.
Parameters
\Drupal\taxonomy\TermInterface $term: A taxonomy term object.
Return value
\Drupal\taxonomy\TermInterface The new taxonomy term object.
1 call to TaxonomyTestTrait::createTaxonomyTermRevision()
- TaxonomyRevisionTest::testVocabularyTermRevision in core/
modules/ taxonomy/ tests/ src/ Functional/ TaxonomyRevisionTest.php - Tests default revision settings on vocabularies.
File
-
core/
modules/ taxonomy/ tests/ src/ Traits/ TaxonomyTestTrait.php, line 76
Class
- TaxonomyTestTrait
- Provides common helper methods for Taxonomy module tests.
Namespace
Drupal\Tests\taxonomy\TraitsCode
protected function createTaxonomyTermRevision(TermInterface $term) {
$term->set('name', $this->randomMachineName());
$term->setNewRevision();
$term->save();
return $term;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.