You are here

public function FormsStepsTestTrait::formsStepsSetup in Forms Steps 8

Perform initial setup tasks that run before every test method.

2 calls to FormsStepsTestTrait::formsStepsSetup()
FormsStepsNavigationTest::setUp in tests/src/Functional/FormsStepsNavigationTest.php
Setup the env for current test using trait methods.
FormsStepsTest::setUp in tests/src/Functional/FormsStepsTest.php
Perform initial setup tasks that run before every test method.

File

tests/src/Traits/FormsStepsTestTrait.php, line 32

Class

FormsStepsTestTrait
Trait FormsStepsTestTrait.

Namespace

Drupal\Tests\forms_steps\Traits

Code

public function formsStepsSetup() {
  $permissions = [
    'administer forms_steps',
    'administer content types',
    'administer nodes',
    'administer forms_steps',
    'administer display modes',
    'administer node fields',
    'administer node display',
    'administer node form display',
  ];
  $this->data = [
    'form_display_modes' => [
      1 => [
        'label' => 'Test Form Mode',
        'id' => 'test_form_mode',
      ],
    ],
    'forms_steps' => [
      'label' => 'Test Form Step',
      'id' => 'test_form_step',
      'description' => 'Test Form Step description',
      'steps' => [
        1 => [
          'label' => 'Add Test Step 1',
          'id' => 'add_test_step_article',
          'target_form_mode' => 'default',
          'target_entity_type' => 'node',
          'target_entity_bundle' => 'article',
          'url' => '/my_test_form/step_1',
          'previous' => NULL,
        ],
        2 => [
          'label' => 'Edit Test Step 2',
          'id' => 'edit_test_step_article',
          'target_form_mode' => 'node.test_form_mode',
          'target_entity_type' => 'node',
          'target_entity_bundle' => 'article',
          'url' => '/my_test_form/step_2',
          'previous' => 'Previous',
        ],
        3 => [
          'label' => 'Add Test Step 3',
          'id' => 'add_test_step_page',
          'target_form_mode' => 'default',
          'target_entity_type' => 'node',
          'target_entity_bundle' => 'page',
          'url' => '/my_test_form/step_3',
          'previous' => 'Previous',
        ],
        4 => [
          'label' => 'Edit Test Step 4',
          'id' => 'edit_test_step_article_bis',
          'target_form_mode' => 'node.test_form_mode',
          'target_entity_type' => 'node',
          'target_entity_bundle' => 'article',
          'url' => '/my_test_form/step_4',
          'previous' => 'Previous',
        ],
      ],
    ],
  ];
  $this
    ->checkPermissions($permissions);
  $this->user = $this
    ->drupalCreateUser($permissions);

  // Login.
  $this
    ->drupalLogin($this->user);
}