Closed (fixed)
Project:
Feeds
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
29 Dec 2019 at 10:32 UTC
Updated:
26 Jan 2020 at 11:24 UTC
Jump to comment: Most recent, Most recent file
Spin-off issue for #2829283: Language support in Feed import
In the latest patch from #2829283: Language support in Feed import (#54 at the time of writing) there is a method that checks for empty values (called valuesAreEmpty(). Since importing empty values is a valid use case, we need test coverage for clearing out values.
The method in question:
+++ b/src/Plugin/Type/Target/FieldTargetBase.php
@@ -76,12 +80,101 @@ abstract class FieldTargetBase extends TargetBase {
+ /**
+ * Check current field has value.
+ *
+ * This is done because we don't want set empty values to entity.
+ *
+ * @return bool
+ * TRUE if field has value.
+ */
+ public function valuesAreEmpty(array $values) {
+ $empty = TRUE;
+ foreach ($values as $value) {
+ foreach ($value as $val) {
+ if (!empty($val)) {
+ $empty = FALSE;
+ break 2;
+ }
+ }
+ }
+ return $empty;
The D7 version of Feeds has test coverage for clearing out values for several field types. To keep work small in this issue, let's only port FeedsMapperFieldTestCase::testClearOutValues() for now.
None.
None.
None.
Patch will follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | interdiff-3103561-4-5.txt | 299 bytes | megachriz |
| #5 | feeds-clear-out-values-test-coverage-3103561-5.patch | 9.88 KB | megachriz |
Comments
Comment #2
megachrizComment #3
megachrizForgot to put test in a group.
Comment #4
megachrizForgot to add the CSV file that contains empty values.
Comment #5
megachrizWorking on multiple things at once makes you forget what files belong to which issue!
Comment #7
megachrizCommitted #5.