Attached patch fixes a couple bugs.

The views UI uses Database, but doesn't "use" it. This bug isn't ever found because we're checking for an instance of views_plugin_query_default, which is no longer the right class name. Both of these result in the query args not being replaced in the preview.

Comments

xjm’s picture

Status: Active » Needs review
Issue tags: +Needs tests
xjm’s picture

Issue tags: +VDC
aspilicious’s picture

I have a feeling this needs tests...

dawehner’s picture

Priority: Major » Normal
Issue tags: -Needs tests
StatusFileSize
new1.74 KB
new2.68 KB

We need tests for so many things.

Status: Needs review » Needs work
Issue tags: +Needs tests

The last submitted patch, core-1820332-4-test.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

Proven that there is a bug.

damiankloip’s picture

Status: Needs review » Needs work

Looks pretty good.

I will create a follow up issue for testing all views settings in the UI match the set variables.

+++ b/core/modules/views/lib/Drupal/views/Tests/UI/SettingsTest.phpundefined
@@ -91,6 +91,29 @@ function testEditUI() {
+    $this->assertFalse(strpos($xpath[0], 'db_condition_placeholder_0') !== FALSE, 'The placeholders in the views sql are not shown directly..');

We should just test for all placeholders here, not just the first?

Also, should this live in it's own method, like testUIPreview or something?

damiankloip’s picture

Also, should this live in it's own method, like testUIPreview or something?

After looking the the testEditUI method, this seems to fit in there, as it tests most other parts of the edit form too.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.66 KB

Later we should enable the settings via config() and test the output, and just test that the settings form is saving the right config.

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

This is looking good.

tim.plunkett’s picture

StatusFileSize
new949 bytes
new2.67 KB

We use instanceof most everywhere else, let's do that here as well.

tim.plunkett’s picture

Title: Db class name bug in views preview » Views preview uses the wrong query class name
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense, and comes with tests. Yay!

Committed and pushed to 8.x. Thanks!

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