You are here

function UserpointsRulesTestCase::createActionRules in User Points 7.2

1 call to UserpointsRulesTestCase::createActionRules()
UserpointsRulesTestCase::testActions in userpoints_rules/userpoints_rules.test
Test the rules actions exposed by this module.

File

userpoints_rules/userpoints_rules.test, line 148
Tests for Userpoints Services integration.

Class

UserpointsRulesTestCase
@file Tests for Userpoints Services integration.

Code

function createActionRules() {
  $grant_action = '{ "rules_userpoints_rules_grant_points_test" : {
        "LABEL" : "Userpoints Rules grant points test",
        "PLUGIN" : "reaction rule",
        "REQUIRES" : [ "rules", "userpoints_rules" ],
        "ON" : [ "user_login" ],
        "DO" : [
          { "userpoints_action_grant_points" : {
              "type" : "userpoints",
              "user" : [ "account" ],
              "points" : "10",
              "tid" : "0",
              "entity" : [ "account" ],
              "description" : "Granted points for logging in.",
              "operation" : "userpoints_rules_login_test",
              "reference" : "Userpoints Rules Test",
              "display" : 1,
              "moderate" : "approved",
              "expirydate" : "+1 year"
            }
          }
        ]
      }
    }';

  // Save the rules.
  $rule = rules_import($grant_action);
  $rule
    ->save();
  drupal_static_reset('rules_get_cache');
  cache_clear_all('*', 'cache_rules', TRUE);
}