function ModerationStateTaxonomyTermTest::testEnforceRevisionsEntityFormAlter
Same name in other branches
- 11.x core/modules/content_moderation/tests/src/Functional/ModerationStateTaxonomyTermTest.php \Drupal\Tests\content_moderation\Functional\ModerationStateTaxonomyTermTest::testEnforceRevisionsEntityFormAlter()
Tests the taxonomy term moderation handler alters the forms as intended.
@covers \Drupal\content_moderation\Entity\Handler\TaxonomyTermModerationHandler::enforceRevisionsEntityFormAlter @covers \Drupal\content_moderation\Entity\Handler\TaxonomyTermModerationHandler::enforceRevisionsBundleFormAlter
File
-
core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationStateTaxonomyTermTest.php, line 43
Class
- ModerationStateTaxonomyTermTest
- Tests the taxonomy term moderation handler.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testEnforceRevisionsEntityFormAlter() : void {
$this->drupalLogin($this->adminUser);
// Enable moderation for the tags vocabulary.
$edit['bundles[tags]'] = TRUE;
$this->drupalGet('/admin/config/workflow/workflows/manage/editorial/type/taxonomy_term');
$this->submitForm($edit, 'Save');
// Check that revision is checked by default when content moderation is
// enabled for the vocabulary.
$this->drupalGet('/admin/structure/taxonomy/manage/tags');
$this->assertSession()
->checkboxChecked('revision');
$this->assertSession()
->pageTextContains('Revisions must be required when moderation is enabled.');
$this->assertSession()
->fieldDisabled('revision');
// Create a taxonomy term and save it as draft.
$term = Term::create([
'name' => 'Test tag',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
$term->save();
// Check that revision is checked by default when editing a term and
// content moderation is enabled for the term's vocabulary.
$this->drupalGet($term->toUrl('edit-form'));
$this->assertSession()
->checkboxChecked('revision');
$this->assertSession()
->pageTextContains('Revisions must be required when moderation is enabled.');
$this->assertSession()
->fieldDisabled('revision');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.