function RulesComponentListBuilderTest::testMultipleContextAction

Tests that an action with a 'multiple' context can be configured.

File

tests/src/Functional/RulesComponentListBuilderTest.php, line 181

Class

RulesComponentListBuilderTest
Tests that the Rules Component list builder pages work.

Namespace

Drupal\Tests\rules\Functional

Code

public function testMultipleContextAction() {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/config/workflow/rules/components');
    $this->clickLink('Add component');
    $this->fillField('Label', 'Test component');
    $this->fillField('Machine-readable name', 'test_component');
    $this->fillField('Description', 'This is a test description for a test component.');
    $this->pressButton('Save');
    $this->clickLink('Add action');
    $this->fillField('Action', 'rules_send_email');
    $this->pressButton('Continue');
    // Push the data selection switch 2 times to make sure that also works and
    // does not throw PHP notices.
    $this->pressButton('Switch to data selection');
    $this->pressButton('Switch to the direct input mode');
    $this->fillField('context_definitions[to][setting]', 'klausi@example.com');
    $this->fillField('context_definitions[subject][setting]', 'subject');
    $this->fillField('context_definitions[message][setting]', 'message');
    $this->pressButton('Save');
    
    /** @var \Drupal\Tests\WebAssert $assert */
    $assert = $this->assertSession();
    $assert->statusCodeEquals(200);
}