function WorkflowUiTest::testWorkflowConfigurationForm

Same name and namespace in other branches
  1. 9 core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testWorkflowConfigurationForm()
  2. 8.9.x core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testWorkflowConfigurationForm()
  3. 10 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 294

Class

WorkflowUiTest
Tests workflow creation UI.

Namespace

Drupal\Tests\workflows\Functional

Code

public function testWorkflowConfigurationForm() : void {
    $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.