Révision c9e51f47
Ajouté par Julien Enselme il y a environ 7 ans
drupal7/modules/field/modules/number/number.test | ||
---|---|---|
152 | 152 |
); |
153 | 153 |
$this->drupalPost(NULL, $edit, t('Save')); |
154 | 154 |
} |
155 |
|
|
156 |
/** |
|
157 |
* Test number_float field. |
|
158 |
*/ |
|
159 |
function testNumberFloatField() { |
|
160 |
$this->field = array( |
|
161 |
'field_name' => drupal_strtolower($this->randomName()), |
|
162 |
'type' => 'number_float', |
|
163 |
'settings' => array( |
|
164 |
'precision' => 8, 'scale' => 4, 'decimal_separator' => '.', |
|
165 |
) |
|
166 |
); |
|
167 |
field_create_field($this->field); |
|
168 |
$this->instance = array( |
|
169 |
'field_name' => $this->field['field_name'], |
|
170 |
'entity_type' => 'test_entity', |
|
171 |
'bundle' => 'test_bundle', |
|
172 |
'widget' => array( |
|
173 |
'type' => 'number', |
|
174 |
), |
|
175 |
'display' => array( |
|
176 |
'default' => array( |
|
177 |
'type' => 'number_float', |
|
178 |
), |
|
179 |
), |
|
180 |
); |
|
181 |
field_create_instance($this->instance); |
|
182 |
|
|
183 |
$langcode = LANGUAGE_NONE; |
|
184 |
$value = array( |
|
185 |
'9.' => '9', |
|
186 |
'.' => '0', |
|
187 |
'123.55' => '123.55', |
|
188 |
'.55' => '0.55', |
|
189 |
'-0.55' => '-0.55', |
|
190 |
); |
|
191 |
foreach($value as $key => $value) { |
|
192 |
$edit = array( |
|
193 |
"{$this->field['field_name']}[$langcode][0][value]" => $key, |
|
194 |
); |
|
195 |
$this->drupalPost('test-entity/add/test-bundle', $edit, t('Save')); |
|
196 |
$this->assertNoText("PDOException"); |
|
197 |
$this->assertRaw($value, 'Correct value is displayed.'); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
155 | 201 |
} |
Formats disponibles : Unified diff
Udpate to 7.54