Namespace
Drupal\Tests\content_moderation\Functional
File
core/modules/content_moderation/tests/src/Functional/ModerationStateTaxonomyTermTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\content_moderation\Functional;
use Drupal\Core\Language\LanguageInterface;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
class ModerationStateTaxonomyTermTest extends ModerationStateTestBase {
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$bundle = Vocabulary::create([
'vid' => 'tags',
'name' => 'Tags',
'new_revision' => FALSE,
])
->save();
}
public function testEnforceRevisionsEntityFormAlter() : void {
$this
->drupalLogin($this->adminUser);
$edit['bundles[tags]'] = TRUE;
$this
->drupalGet('/admin/config/workflow/workflows/manage/editorial/type/taxonomy_term');
$this
->submitForm($edit, 'Save');
$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');
$term = Term::create([
'name' => 'Test tag',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
$term
->save();
$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');
}
}
Classes