You are here

protected function RulesTestCase::createTestRule in Rules 7.2

Same name and namespace in other branches
  1. 8.3 d7-tests/rules_test_case.test \RulesTestCase::createTestRule()

Helper function to create a test Rule.

3 calls to RulesTestCase::createTestRule()
RulesTestCase::testRuleCreation in tests/rules.test
Tests creating a rule and iterating over the rule elements.
RulesTestCase::testRulesCrud in tests/rules.test
Tests CRUD functionality.
RulesTestCase::testSorting in tests/rules.test
Tests sorting rule elements.

File

tests/rules.test, line 48
Rules tests.

Class

RulesTestCase
Rules test cases.

Code

protected function createTestRule() {
  $rule = rule();
  $rule
    ->condition('rules_test_condition_true')
    ->condition('rules_test_condition_true')
    ->condition(rules_or()
    ->condition(rules_condition('rules_test_condition_true')
    ->negate())
    ->condition('rules_test_condition_false')
    ->condition(rules_and()
    ->condition('rules_test_condition_false')
    ->condition('rules_test_condition_true')
    ->negate()));
  $rule
    ->action('rules_test_action');
  return $rule;
}