protected function RulesConditionalSwitchTestCase::createTestComponent in Conditional Rules 8
Same name and namespace in other branches
- 7 tests/rules_conditional.test \RulesConditionalSwitchTestCase::createTestComponent()
Creates an action set to test a conditional.
2 calls to RulesConditionalSwitchTestCase::createTestComponent()
- RulesConditionalSwitchTestCase::testEvaluate in tests/
rules_conditional.test - Tests evaluation.
- RulesConditionalSwitchTestCase::testExport in tests/
rules_conditional.test - Tests exporting.
File
- tests/
rules_conditional.test, line 440 - SimpleTest testing suites.
Class
- RulesConditionalSwitchTestCase
- Switch tests.
Code
protected function createTestComponent() {
return rules_action_set(array(
'node' => array(
'type' => 'node',
'label' => 'Node',
),
))
->action(rules_conditional_switch('node:title')
->case(array(
'value' => 'case 1',
))
->action('rules_conditional_test_throw', array(
'message' => 'case',
))
->case(array(
'value' => 'case 2',
), TRUE)
->action('data_set', array(
'data:select' => 'node:title',
'value' => 'fall through',
))
->case(array(
'value' => 'case 3',
))
->action('rules_conditional_test_throw', array(
'message' => 'case 3',
))
->defaultCase()
->action('rules_conditional_test_throw', array(
'message' => 'default',
)));
}