You are here

public function ModerationStateNodeTypeTest::testNotModerated in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php \Drupal\Tests\content_moderation\Functional\ModerationStateNodeTypeTest::testNotModerated()

A node type without moderation state disabled.

@covers \Drupal\content_moderation\EntityTypeInfo::formAlter @covers \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter

File

core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php, line 23

Class

ModerationStateNodeTypeTest
Tests moderation state node type integration.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function testNotModerated() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->createContentTypeFromUi('Not moderated', 'not_moderated');
  $this
    ->assertSession()
    ->pageTextContains('The content type Not moderated has been added.');
  $this
    ->grantUserPermissionToCreateContentOfType($this->adminUser, 'not_moderated');
  $this
    ->drupalGet('node/add/not_moderated');
  $this
    ->assertSession()
    ->pageTextContains('Save');
  $this
    ->submitForm([
    'title[0][value]' => 'Test',
  ], 'Save');
  $this
    ->assertSession()
    ->pageTextContains('Not moderated Test has been created.');
}