You are here

protected function ModerationStateTestBase::createContentTypeFromUi in Workbench Moderation 8

Creates a content-type from the UI.

Parameters

string $content_type_name: Content type human name.

string $content_type_id: Machine name.

bool $moderated: TRUE if should be moderated.

string[] $allowed_states: Array of allowed state IDs.

string $default_state: Default state.

6 calls to ModerationStateTestBase::createContentTypeFromUi()
ModerationFormTest::setUp in tests/src/Functional/ModerationFormTest.php
Sets the test up.
ModerationLocaleTest::testTranslateModeratedContent in tests/src/Functional/ModerationLocaleTest.php
Test article translatable.
ModerationStateNodeTest::setUp in tests/src/Functional/ModerationStateNodeTest.php
Sets the test up.
ModerationStateNodeTypeTest::testEnablingOnExistingContent in tests/src/Functional/ModerationStateNodeTypeTest.php
A node type without moderation state enabled.
ModerationStateNodeTypeTest::testNotModerated in tests/src/Functional/ModerationStateNodeTypeTest.php
A node type without moderation state disabled.

... See full list

File

tests/src/Functional/ModerationStateTestBase.php, line 96

Class

ModerationStateTestBase
Defines a base class for moderation state tests.

Namespace

Drupal\Tests\workbench_moderation\Functional

Code

protected function createContentTypeFromUi($content_type_name, $content_type_id, $moderated = FALSE, array $allowed_states = [], $default_state = NULL) {
  $this
    ->drupalGet('admin/structure/types');
  $this
    ->clickLink('Add content type');
  $edit = [
    'name' => $content_type_name,
    'type' => $content_type_id,
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save content type'));
  if ($moderated) {
    $this
      ->enableModerationThroughUi($content_type_id, $allowed_states, $default_state);
  }
}