function WorkflowUiTest::testWorkflowConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testWorkflowConfigurationForm()
  2. 10 core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testWorkflowConfigurationForm()
  3. 11.x core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testWorkflowConfigurationForm()

Tests the workflow configuration form.

File

core/modules/workflows/tests/src/Functional/WorkflowUiTest.php, line 290

Class

WorkflowUiTest
Tests workflow creation UI.

Namespace

Drupal\Tests\workflows\Functional

Code

public function testWorkflowConfigurationForm() {
    $workflow = Workflow::create([
        'id' => 'test',
        'type' => 'workflow_type_complex_test',
        'label' => 'Test',
    ]);
    $workflow->getTypePlugin()
        ->addState('published', 'Published')
        ->addTransition('publish', 'Publish', [
        'published',
    ], 'published');
    $workflow->save();
    $this->drupalLogin($this->createUser([
        'administer workflows',
    ]));
    // Add additional information to the workflow via the configuration form.
    $this->drupalGet('admin/config/workflow/workflows/manage/test');
    $this->assertSession()
        ->pageTextContains('Example global workflow setting');
    $this->submitForm([
        'type_settings[example_setting]' => 'Extra global settings',
    ], 'Save');
    $workflow_storage = $this->container
        ->get('entity_type.manager')
        ->getStorage('workflow');
    $workflow = $workflow_storage->loadUnchanged('test');
    $this->assertEquals('Extra global settings', $workflow->getTypePlugin()
        ->getConfiguration()['example_setting']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.