public function UiPageTest::testCreateReactionRule in Rules 8.3
Tests that creating a reaction rule works.
5 calls to UiPageTest::testCreateReactionRule()
- UiPageTest::testCancelExpressionInRule in tests/
src/ Functional/ UiPageTest.php - Tests that cancelling an expression from a rule works.
- UiPageTest::testDeleteExpressionInRule in tests/
src/ Functional/ UiPageTest.php - Tests that deleting an expression from a rule works.
- UiPageTest::testNegatedCondition in tests/
src/ Functional/ UiPageTest.php - Tests that a negated condition has NOT prefixed to its label.
- UiPageTest::testNoContextCondition in tests/
src/ Functional/ UiPageTest.php - Tests that a condition with no context can be configured.
- UiPageTest::testRuleStatusOperations in tests/
src/ Functional/ UiPageTest.php - Tests that enabling and disabling a rule works.
File
- tests/
src/ Functional/ UiPageTest.php, line 46
Class
- UiPageTest
- Tests that the Rules UI pages are reachable.
Namespace
Drupal\Tests\rules\FunctionalCode
public function testCreateReactionRule() {
$account = $this
->drupalCreateUser([
'administer rules',
]);
$this
->drupalLogin($account);
$this
->drupalGet('admin/config/workflow/rules');
$this
->clickLink('Add reaction rule');
$this
->fillField('Label', 'Test rule');
$this
->fillField('Machine-readable name', 'test_rule');
$this
->fillField('React on event', 'rules_entity_insert:node');
$this
->pressButton('Save');
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('Reaction rule Test rule has been created.');
$this
->clickLink('Add condition');
$this
->fillField('Condition', 'rules_node_is_promoted');
$this
->pressButton('Continue');
$this
->fillField('context_definitions[node][setting]', 'node');
$this
->pressButton('Save');
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('You have unsaved changes.');
$this
->pressButton('Save');
$assert
->pageTextContains('Reaction rule Test rule has been updated. ');
}