Updated: Comment #0

Problem/Motivation

We have IntegerItem (id integer_field) to wrap the integer data type, but no FloatItem to wrap the float data type

Proposed resolution

Add one

Remaining tasks

Review

User interface changes

None

API changes

None

None

Files: 
CommentFileSizeAuthor
#1 float-item.patch2.34 KBlarowlan
PASSED: [[SimpleTest]]: [MySQL] 59,061 pass(es).
[ View ]

Comments

StatusFileSize
new2.34 KB
PASSED: [[SimpleTest]]: [MySQL] 59,061 pass(es).
[ View ]

Why s this task and not a feature request?

+++ b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
@@ -570,12 +570,12 @@ public function testTypedDataValidation() {
-      'type' => 'integer_field',
+      'type' => 'float_field',
...
-    $field_item = $this->typedData->create($definition, array('value' => 10));
+    $field_item = $this->typedData->create($definition, array('value' => 11.5));

Why are we replacing these lines? Should we not be adding new test?

@jibran
I classed it as a task because its an oversight that its missing, and I filed it in response to a direct question about why didn't we have one from someone porting a module to D8.
I changed the tests because they are verifying validation works for typed data, only integer_field is tested yet there are numerous others. I figured so long as we keep testing validation (which we are) but we use an alternate type (float) then we get the best of both worlds - we continue testing validation, but we also get float field testing. There are other remaining validation tests that test integer field

Status:Needs review» Reviewed & tested by the community

I have no further questions.

Status:Reviewed & tested by the community» Fixed

Committed bd5e049 and pushed to 8.x. Thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.