You are here

public function TokenReplacementTest::testTokenReplacement in Tokens in Views Filter Criteria 8

Tests token replacement in filters.

File

tests/src/Kernel/TokenReplacementTest.php, line 49

Class

TokenReplacementTest
Tests handler token replacement in filter.

Namespace

Drupal\Tests\token_views_filter\Kernel

Code

public function testTokenReplacement() {
  $view = Views::getView('test_token_filter');
  $view
    ->initDisplay();
  $this
    ->executeView($view);
  $this
    ->assertSame('Drupal', $view->filter['test_filter_string']->value);
  $this
    ->assertSame([
    'min' => '',
    'max' => '',
    'value' => '333',
  ], $view->filter['test_filter_numeric']->value);
  $this
    ->assertSame([
    'min' => '111',
    'max' => '999',
    'value' => '',
  ], $view->filter['test_filter_numeric_between']->value);
  $this
    ->assertSame([
    'min' => '',
    'max' => '',
    'value' => date('Y-m-d'),
    'type' => 'date',
  ], $view->filter['test_filter_date']->value);
  $this
    ->assertSame([
    'min' => '',
    'max' => '',
    'value' => date('Y-m-d'),
    'type' => 'date',
  ], $view->filter['test_filter_datetime']->value);
}