You are here

protected function ModerationStateTestBase::createContentTypeFromUI in Workbench Moderation 8.2

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 src/Tests/ModerationFormTest.php
Sets the test up.
ModerationLocaleTest::testTranslateModeratedContent in src/Tests/ModerationLocaleTest.php
Test that an article can be translated and its translations can be moderated separately as core does.
ModerationStateNodeTest::setUp in src/Tests/ModerationStateNodeTest.php
Sets the test up.
ModerationStateNodeTypeTest::testEnablingOnExistingContent in src/Tests/ModerationStateNodeTypeTest.php
A node type without moderation state enabled.
ModerationStateNodeTypeTest::testNotModerated in src/Tests/ModerationStateNodeTypeTest.php
A node type without moderation state disabled.

... See full list

File

src/Tests/ModerationStateTestBase.php, line 87

Class

ModerationStateTestBase
Defines a base class for moderation state tests.

Namespace

Drupal\workbench_moderation\Tests

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);
  }
}