Projet

Général

Profil

Révision a45e4bc1

Ajouté par Assos Assos il y a presque 9 ans

Update webform to 4.10

Voir les différences:

drupal7/sites/all/modules/webform/tests/submission.test
22 22
  /**
23 23
   * Implements setUp().
24 24
   */
25
  function setUp() {
26
    parent::setUp();
25
  function setUp($added_modules = array()) {
26
    parent::setUp($added_modules);
27 27
  }
28 28

  
29 29
  /**
......
70 70
    $this->drupalLogin($this->webform_users['admin']);
71 71
    $this->webformReset();
72 72

  
73
    // Create the Webform test node, and set all components to be mandatory
73
    // Create the Webform test node, and set all components to be required
74 74
    // with no default value.
75 75
    $node = $this->testWebformForm();
76 76
    $node = node_load($node->nid);
77 77
    foreach ($node->webform['components'] as &$component) {
78 78
      $component['value'] = '';
79
      $component['mandatory'] = '1';
79
      $component['required'] = '1';
80 80
    }
81 81
    node_save($node);
82 82

  
83 83
    // Submit the webform with no data. We should get a message that all the
84 84
    // components are required. (The exceptions are hidden fields, which can't
85
    // be made mandatory, and date fields, which default to the current date
85
    // be made required, and date fields, which default to the current date
86 86
    // when no default value is provided; therefore, we don't expect a message
87 87
    // for those.)
88 88
    $this->drupalPost('node/' . $node->nid, array(), 'Submit', array(), array(), 'webform-client-form-' . $node->nid);
......
109 109
    $node = $this->testWebformForm();
110 110
    $submission_values = $value_type == 'sample' ? $this->testWebformPost() : array();
111 111

  
112
    // Visit the node page with the "foo=bar" query, to test %get[] default values.
112
    // Visit the node page with the "foo=bar" query, to test
113
    // [current-page:query:?] default values.
113 114
    $this->drupalGet('node/' . $node->nid, array('query' => array('foo' => 'bar')));
114
    $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Webform node created and accessible at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
115
    $this->assertText($node->title, t('Webform node created and accessible at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
115 116

  
116 117
    // Submit our test data.
117 118
    $this->drupalPost(NULL, $submission_values, 'Submit', array(), array(), 'webform-client-form-' . $node->nid);
......
125 126
    $sid = $matches[1];
126 127

  
127 128
    // Pull in the database submission and check the values.
128
    $actual_submission = webform_get_submission($node->nid, $sid, TRUE);
129
    drupal_static_reset('webform_get_submission');
130
    $actual_submission = webform_get_submission($node->nid, $sid);
129 131

  
130 132
    $component_info = $this->testWebformComponents();
131 133
    foreach ($node->webform['components'] as $cid => $component) {
132 134
      $stable_value = $value_type == 'sample' ? $component_info[$component['form_key']]['database values'] : $component_info[$component['form_key']]['database default values'];
133
      $actual_value = $actual_submission->data[$cid]['value'];
134
      $result = $this->assertEqual($stable_value, $actual_value, t('Component @form_key data integrity check', array('@form_key' => $component['form_key'])), t('Webform'));
135
      $actual_value = $actual_submission->data[$cid];
136
      $result = $this->assertEqual($stable_value, $actual_value, t('Component @form_key data integrity check when using @type values.', array('@form_key' => $component['form_key'], '@type' => $value_type)), t('Webform'));
135 137
      if (!$result || $result === 'fail') {
136 138
        $this->fail(t('Expected !expected', array('!expected' => print_r($stable_value, TRUE))) . "\n\n" . t('Recieved !recieved', array('!recieved' => print_r($actual_value, TRUE))), t('Webform'));
137 139
      }

Formats disponibles : Unified diff