Skip to content
Snippets Groups Projects
Commit b1429b24 authored by catch's avatar catch
Browse files

Issue #3055152 by shalini_jha, manpreet_singh, kfritsche, quietone,...

Issue #3055152 by shalini_jha, manpreet_singh, kfritsche, quietone, smustgrave, daffie, jimyhuang: Views StringFilter doesn't escape % character

(cherry picked from commit f333c6bc)
parent f637dda0
Branches
Tags
6 merge requests!13092Issue #3498963 by benjifisher, heddn: Add lookup_migrations configuration to...,!12802Issue #3537193 by opauwlo: Add enable absolute path option for CKEditor5 image uploads,!12684Issue #3220784,!12523Issue #3493858 by vidorado, xavier.masson, smustgrave: Extend ViewsBlockBase...,!122353526426-warning-for-missing,!8559#3450868 Add ViewsConfigUpdater deprecation support for default_argument_skip_url
Pipeline #426672 passed with warnings
Pipeline: drupal

#426680

    Pipeline: drupal

    #426676

      ......@@ -354,7 +354,7 @@ public function query() {
      * Adds a where clause for the operation, 'equals'.
      */
      public function opEqual($field) {
      $this->query->addWhere($this->options['group'], $field, $this->value, $this->operator());
      $this->query->addWhere($this->options['group'], $field, $this->connection->escapeLike($this->value), $this->operator());
      }
      protected function opContains($field) {
      ......
      ......@@ -4,6 +4,7 @@
      namespace Drupal\Tests\views\Kernel\Handler;
      use Drupal\Core\Database\Database;
      use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
      use Drupal\views\Views;
      ......@@ -113,6 +114,45 @@ public function testFilterStringEqual(): void {
      ],
      ];
      $this->assertIdenticalResultset($view, $resultset, $this->columnMap);
      $view->destroy();
      // Get the original dataset
      $data_set = $this->dataSet();
      // Adds a new data point in the views_test_data table.
      $query = Database::getConnection()->insert('views_test_data')
      ->fields(array_keys($data_set[0]));
      $query->values([
      'name' => 'Ringo%',
      'age' => 31,
      'job' => 'Drummer',
      'created' => gmmktime(6, 30, 10, 1, 1, 2000),
      'status' => 1,
      'description' => NULL,
      ]);
      $query->execute();
      $view = Views::getView('test_view');
      $view->setDisplay();
      // Change the filtering
      $view->displayHandlers->get('default')->overrideOption('filters', [
      'name' => [
      'id' => 'name',
      'table' => 'views_test_data',
      'field' => 'name',
      'relationship' => 'none',
      'operator' => '=',
      'value' => 'Ringo%',
      ],
      ]);
      $this->executeView($view);
      $resultset = [
      [
      'name' => 'Ringo%',
      ],
      ];
      $this->assertIdenticalResultset($view, $resultset, $this->columnMap);
      }
      public function testFilterStringGroupedExposedEqual(): void {
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please to comment