Commit ff5ac654 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2505997 by olli, peterpoe, Lendude: User error: "preview" is an invalid render array key

(cherry picked from commit 58bd5a3a)
parent 8d6a091a
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
langcode: en
status: true
dependencies:
  module:
    - user
id: test_preview_error
label: test_preview_error
module: views
description: ''
tag: ''
base_table: views_test_data
base_field: id
core: 8.x
display:
  default:
    display_plugin: default
    id: default
    display_title: Master
    position: null
    display_options:
      row:
        type: fields
      fields: { }
+13 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class PreviewTest extends UITestBase {
   *
   * @var array
   */
  public static $testViews = array('test_preview', 'test_pager_full', 'test_mini_pager');
  public static $testViews = array('test_preview', 'test_preview_error', 'test_pager_full', 'test_mini_pager');

  /**
   * Tests contextual links in the preview form.
@@ -230,6 +230,18 @@ public function testPreviewAdditionalInfo() {
    $this->assertRaw('css/views_ui_test.test.css', 'Attached CSS asset found.');
  }

  /**
   * Tests view validation error messages in the preview.
   */
  public function testPreviewError() {
    $this->drupalGet('admin/structure/views/view/test_preview_error/edit');
    $this->assertResponse(200);

    $this->drupalPostForm(NULL, $edit = array(), t('Update preview'));

    $this->assertText('Unable to preview due to validation errors.', 'Preview error text found.');
  }

  /**
   * Get the preview form and force an AJAX preview update.
   *
+1 −1
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ public function renderPreview($display_id, $args = array()) {
          drupal_set_message($error, 'error');
        }
      }
      $preview = t('Unable to preview due to validation errors.');
      $preview = ['#markup' => t('Unable to preview due to validation errors.')];
    }

    // Assemble the preview, the query info, and the query statistics in the