Révision 01f36513
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/webform/tests/WebformSubmissionTestCase.test | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 | 3 |
/** |
4 |
* @file |
|
5 | 4 |
* Webform module submission tests. |
6 | 5 |
*/ |
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 | 6 |
class WebformSubmissionTestCase extends WebformTestCase { |
12 | 7 |
|
13 | 8 |
/** |
... | ... | |
69 | 64 |
node_save($node); |
70 | 65 |
|
71 | 66 |
// Submit the webform with no data. We should get a message that all the |
72 |
// components are required. (The exceptions are hidden fields, which can't
|
|
73 |
// be made required, and date fields, which default to the current date
|
|
74 |
// when no default value is provided; therefore, we don't expect a message
|
|
75 |
// for those.)
|
|
67 |
// components are required. The exceptions are hidden fields, which can't be
|
|
68 |
// made required, and date fields, which default to the current date when no
|
|
69 |
// default value is provided; therefore, we don't expect a message for
|
|
70 |
// those.
|
|
76 | 71 |
$this->drupalPost('node/' . $node->nid, array(), 'Submit', array(), array(), 'webform-client-form-' . $node->nid); |
77 | 72 |
foreach ($node->webform['components'] as $component) { |
78 | 73 |
if ($component['type'] != 'hidden' && $component['type'] != 'date') { |
... | ... | |
124 | 119 |
/** |
125 | 120 |
* Execute the submission test. |
126 | 121 |
* |
127 |
* @param $value_type |
|
122 |
* @param string $value_type
|
|
128 | 123 |
* The values to be submitted to the webform. Either "sample" or "default". |
129 | 124 |
*/ |
130 | 125 |
public function webformSubmissionExecute($value_type = 'sample') { |
... | ... | |
168 | 163 |
|
169 | 164 |
/** |
170 | 165 |
* Execute a validation check for a single component. |
171 |
* |
|
172 |
* @param $value_type |
|
173 |
* The values to be submitted to the webform. Either "sample" or "default". |
|
174 | 166 |
*/ |
175 | 167 |
public function webformSubmissionValidateExecute() { |
176 | 168 |
$path = drupal_get_path('module', 'webform'); |
... | ... | |
191 | 183 |
// Submit our test data. |
192 | 184 |
$this->drupalPost('node/' . $node->nid, $submission_values, 'Submit', array(), array(), 'webform-client-form-' . $node->nid); |
193 | 185 |
|
194 |
// Confirm that the validation error occurred and the submission did not save. |
|
186 |
// Confirm that the validation error occurred and the submission did |
|
187 |
// not save. |
|
195 | 188 |
$this->assertRaw($error_message, t('Validation message properly thrown: "%message".', array('%message' => $error_message)), t('Webform')); |
196 | 189 |
|
197 | 190 |
$this->assertFalse(preg_match('/sid=([0-9]+)/', $this->getUrl()), t('Submission not saved.')); |
Formats disponibles : Unified diff
Weekly update of contrib modules