Project

General

Profile

Revision 76bdcd04

Added by Assos Assos almost 6 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/webform/tests/WebformConditionalsTestCase.test
41 41
    }
42 42

  
43 43
    $this->drupalLogout();
44

  
45
    // Test that the whole conditional is deleted when all source components are
46
    // deleted. Inital setup: Two components. One source (c1) one target (c2).
47
    $node = (object) array(
48
      'type' => 'webform',
49
      'title' => 'Conditional test',
50
    );
51
    $default = array(
52
      'type' => 'textfield',
53
      'pid' => 0,
54
    );
55
    webform_component_defaults($default);
56
    node_object_prepare($node);
57
    $node->webform['components'][1] = array(
58
      'cid' => 1,
59
      'form_key' => 'c1',
60
    ) + $default;
61
    $node->webform['components'][2] = array(
62
      'cid' => 2,
63
      'form_key' => 'c2',
64
    ) + $default;
65
    $node->webform['conditionals'][0] = array(
66
      'rgid' => 0,
67
      'andor' => NULL,
68
      'weight' => -1,
69
      'rules' => array(array(
70
        'source_type' => 'component',
71
        'source' => 1,
72
        'operator' => 'not_empty',
73
      ),
74
      ),
75
      'actions' => array(array(
76
        'target_type' => 'component',
77
        'target' => 2,
78
        'action' => 'show',
79
      ),
80
      ),
81
    );
82
    node_save($node);
83

  
84
    // Delete the source.
85
    unset($node->webform['components'][1]);
86
    node_save($node);
87

  
88
    $this->assertEqual(array(), $node->webform['conditionals'], 'The whole conditional is deleted when all source components are deleted.');
44 89
  }
45 90

  
46 91
  /**

Also available in: Unified diff