function FilterStringTest::testFilterStringNotStarts

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::testFilterStringNotStarts()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::testFilterStringNotStarts()
  3. 10 core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::testFilterStringNotStarts()

Tests filtering by string using the "does not start with" operator.

File

core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php, line 534

Class

FilterStringTest
Tests the core Drupal\views\Plugin\views\filter\StringFilter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterStringNotStarts() : void {
  $view = Views::getView('test_view');
  $view->setDisplay();
  // Change the filtering
  $view->displayHandlers
    ->get('default')
    ->overrideOption('filters', [
    'description' => [
      'id' => 'description',
      'table' => 'views_test_data',
      'field' => 'description',
      'relationship' => 'none',
      'operator' => 'not_starts',
      'value' => 'gEorge',
    ],
  ]);
  $this->executeView($view);
  $resultset = [
    [
      'name' => 'John',
    ],
    [
      'name' => 'Ringo',
    ],
    [
      'name' => 'Paul',
    ],
  ];
  $this->assertIdenticalResultset($view, $resultset, $this->columnMap);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.