You are here

protected function RulesConditionalWhileTestCase::createTestComponent in Conditional Rules 7

Same name and namespace in other branches
  1. 8 tests/rules_conditional.test \RulesConditionalWhileTestCase::createTestComponent()

Creates an action set to test a conditional.

2 calls to RulesConditionalWhileTestCase::createTestComponent()
RulesConditionalWhileTestCase::testEvaluate in tests/rules_conditional.test
Tests evaluation.
RulesConditionalWhileTestCase::testExport in tests/rules_conditional.test
Tests exporting.

File

tests/rules_conditional.test, line 539
SimpleTest testing suites.

Class

RulesConditionalWhileTestCase
While tests.

Code

protected function createTestComponent() {
  return rules_action_set(array())
    ->action('variable_add', array(
    'type' => 'integer',
    'value' => 0,
    'variable_added:var' => 'count',
    'variable_added:label' => 'Count',
  ))
    ->action(rules_conditional_while('data_is', array(
    'data:select' => 'count',
    'op' => '>',
    'value' => 10,
  ))
    ->negate()
    ->action('data_set', array(
    'data:select' => 'count',
    'value:select' => 'count',
    'value:process' => array(
      'num_offset' => array(
        'value' => 1,
      ),
    ),
  )))
    ->action('rules_conditional_test_throw', array(
    'message:select' => 'count',
  ));
}