Support from Acquia helps fund testing for Drupal Acquia logo

Comments

derhasi’s picture

One solution could be to use $fields[] = " IFNULL($field->table_alias.$field->real_field, '')";, but i guess this is restricted to MySQL.
Another would be to use OR clauses for checking each field separately, instead of using CONCAT.

dawehner’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
574 bytes

When we developed this filter we said: Let's make sure it works for most cases, because for example certain handlers will work a bit different internally.

So what we actually want on this issue is contact_ws, see http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_co...

It would be cool if there would be simpletests for this handler type.

derhasi’s picture

oh, yes, sure CONCAT_WS is a solution. I attached a patch with the additional ' ' as a separator.
Within that patch there's also a test (my first one ever).

tim.plunkett’s picture

Uploading the test separately to see that it fails, and adding it to the .info file.

Status: Needs review » Needs work

The last submitted patch, views-1494226-4.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
3.71 KB
3.14 KB

Okay, rewrote a chunk of the test.

Status: Needs review » Needs work

The last submitted patch, views-1494226-6.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
3.85 KB
3.29 KB

Okay, I hate override_option.

Status: Needs review » Needs work

The last submitted patch, views-1494226-8.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review

#8: views-1494226-8-test-only.patch queued for re-testing.

tim.plunkett’s picture

#8: views-1494226-8.patch queued for re-testing.

tim.plunkett’s picture

Assigned: Unassigned » dawehner

git.d.o went down, hence the retests.

The test was very close, glad to have more coverage (even though we'll now have more than 1337 tests)

tim.plunkett’s picture

+++ b/tests/handlers/views_handler_filter_combine.testundefined
@@ -0,0 +1,108 @@
+    $fields = $view->display['default']->handler->options['fields'];
+    $fields += array(
+      'job' => array(
+        'id' => 'job',
+        'table' => 'views_test',
+        'field' => 'job',
+        'relationship' => 'none',
+      ),
+    );
+    $view->display['default']->handler->override_option('fields', $fields);

This part is the only reason I didn't RTBC. There seems to be no better way to do it, but I wanted to check.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)
+++ b/tests/handlers/views_handler_filter_combine.testundefined
@@ -0,0 +1,108 @@
+    $fields += array(
+      'job' => array(
+        'id' => 'job',
+        'table' => 'views_test',
+        'field' => 'job',
+        'relationship' => 'none',
+      ),
+    );
+    $view->display['default']->handler->override_option('fields', $fields);

From my experience you can use
$view->display['default']->display_options['fields']['foo'] = array(id' => 'job'...) but if it works things like that doesn't matter that much. Just changed it and committed it.

Thanks for the work!!

If the compound filter will be backported this fix should be considered as well.

tim.plunkett’s picture

I KNEW there was a way to do it. I kept trying to add to $view->display['default']->handler->options['fields'] and $view->display['default']->options['fields'], which made it show up, but not get added to $this->view->fields. Thanks!

derhasi’s picture

tim and daniel, thanks for making the test work ;)

Chris Matthews’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue