You are here

public function ViewsRulesUpdateTestCase::testCleanCollectActionVariableNames in Views Rules 7

Tests views_rules_update_clean_collect_action_variable_names().

File

tests/views_rules.test, line 442
Simpletest implementations.

Class

ViewsRulesUpdateTestCase
Test suite for updates.

Code

public function testCleanCollectActionVariableNames() {
  $action = rules_action('views_rules_collect_rows', array(
    'views_rules_display' => 'views_rules_test:views_rules_1',
    'tid:select' => 'term:tid',
    'type' => 'article',
    'nid:var' => 'list_nid',
    'nid:label' => 'List of node IDs',
    'title:var' => 'list_title',
    'title:label' => 'List of node titles',
  ));
  $comp = rules_action_set(array(
    'term' => array(
      'type' => 'taxonomy_term',
      'label' => 'Term',
    ),
  ))
    ->action($action);
  views_rules_update_clean_collect_action_variable_names($comp);
  $expectedSettings = array(
    'views_rules_display' => 'views_rules_test:views_rules_1',
    'tid:select' => 'term:tid',
    'type' => 'article',
    'nid:var' => 'list_nid',
    'nid:label' => 'List of node IDs',
    'title:var' => 'list_title',
    'title:label' => 'List of node titles',
  );
  $updatedSettings = array_intersect_key($action->settings, array_flip(array_filter(array_keys($action->settings), 'element_child')));
  $this
    ->assertIdentical($expectedSettings, $updatedSettings, 'Prefixed collect action variable names are cleaned.');
}