You are here

public function ArgumentDateTest::testMonthHandler in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentDateTest::testMonthHandler()
  2. 9 core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentDateTest::testMonthHandler()

Tests the Month handler.

See also

\Drupal\node\Plugin\views\argument\CreatedMonth

File

core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php, line 120

Class

ArgumentDateTest
Tests the core date argument handlers.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testMonthHandler() {
  $view = Views::getView('test_argument_date');
  $view
    ->setDisplay('embed_2');
  $this
    ->executeView($view, [
    '01',
  ]);
  $expected = [];
  $expected[] = [
    'id' => 1,
  ];
  $expected[] = [
    'id' => 2,
  ];
  $expected[] = [
    'id' => 3,
  ];
  $expected[] = [
    'id' => 4,
  ];
  $expected[] = [
    'id' => 5,
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->columnMap);
  $view
    ->destroy();
  $view
    ->setDisplay('embed_2');
  $this
    ->executeView($view, [
    '12',
  ]);
  $expected = [];
  $this
    ->assertIdenticalResultset($view, $expected, $this->columnMap);
}