You are here

public function ArgumentDateTest::testDayHandler in Drupal 9

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

Tests the Day handler.

See also

\Drupal\node\Plugin\views\argument\CreatedDay

File

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

Class

ArgumentDateTest
Tests the core date argument handlers.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

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