Commit fee84369 authored by catch's avatar catch
Browse files

Issue #2810985 by _Archy_, smustgrave, GoZ, joelpittet, csheltonlcm,...

Issue #2810985 by _Archy_, smustgrave, GoZ, joelpittet, csheltonlcm, ayush.khare, Lendude: Remove duplicate condition

(cherry picked from commit 803264a2)
parent 4c116a3f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public function query() {
      $field = $this->view->field[$id];
      // Always add the table of the selected fields to be sure a table alias exists.
      $field->ensureMyTable();
      if (!empty($field->field_alias) && !empty($field->field_alias)) {
      if (!empty($field->tableAlias) && !empty($field->realField)) {
        $fields[] = "$field->tableAlias.$field->realField";
      }
    }
+55 −0
Original line number Diff line number Diff line
@@ -569,6 +569,61 @@ public function testFilterCombineNot() {
    $this->assertIdenticalResultset($view, $resultset, $this->columnMap);
  }

  /**
   * Tests the combine filter when no realName is used.
   */
  public function testFilterCombineNoRealName() {
    $view = Views::getView('test_view');
    $view->setDisplay();

    $fields = $view->displayHandlers->get('default')->getOption('fields');
    $view->displayHandlers->get('default')->overrideOption('fields', $fields + [
      'name_no_id' => [
        'id' => 'name_no_id',
        'table' => 'views_test_data',
        'field' => 'name_fail',
        'relationship' => 'none',
      ],
    ]);

    // Change the filtering.
    $view->displayHandlers->get('default')->overrideOption('filters', [
      'age' => [
        'id' => 'combine',
        'table' => 'views',
        'field' => 'combine',
        'relationship' => 'none',
        'operator' => 'contains',
        'fields' => [
          'name_no_id',
          'job',
        ],
        'value' => 'iNg',
      ],
    ]);

    $this->executeView($view);
    $resultset = [
      [
        'name' => 'John',
        'job' => 'Singer',
      ],
      [
        'name' => 'George',
        'job' => 'Singer',
      ],
      [
        'name' => 'Ringo',
        'job' => 'Drummer',
      ],
      [
        'name' => 'Ginger',
        'job' => NULL,
      ],
    ];
    $this->assertNotIdenticalResultset($view, $resultset, $this->columnMap);
  }

  /**
   * Additional data to test the NULL issue.
   */