You are here

public function OptionsListArgumentTest::testViewsTestOptionsListArgument in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/options/tests/src/Kernel/Views/OptionsListArgumentTest.php \Drupal\Tests\options\Kernel\Views\OptionsListArgumentTest::testViewsTestOptionsListArgument()

Tests the options field argument.

File

core/modules/options/tests/src/Kernel/Views/OptionsListArgumentTest.php, line 25

Class

OptionsListArgumentTest
Tests options list argument for views.

Namespace

Drupal\Tests\options\Kernel\Views

Code

public function testViewsTestOptionsListArgument() {
  $view = Views::getView('test_options_list_argument_numeric');
  $this
    ->executeView($view, [
    1,
  ]);
  $resultset = [
    [
      'nid' => $this->nodes[0]->nid->value,
    ],
    [
      'nid' => $this->nodes[1]->nid->value,
    ],
  ];
  $column_map = [
    'nid' => 'nid',
  ];
  $this
    ->assertIdenticalResultset($view, $resultset, $column_map);
  $view = Views::getView('test_options_list_argument_string');
  $this
    ->executeView($view, [
    'man',
    'woman',
  ]);
  $resultset = [
    [
      'nid' => $this->nodes[0]->nid->value,
    ],
    [
      'nid' => $this->nodes[1]->nid->value,
    ],
  ];
  $column_map = [
    'nid' => 'nid',
  ];
  $this
    ->assertIdenticalResultset($view, $resultset, $column_map);
}