You are here

public function ArgumentDateTimeTest::testDatetimeArgumentFullDate in Drupal 9

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

Tests full_date CCYYMMDD argument.

File

core/modules/datetime/tests/src/Kernel/Views/ArgumentDateTimeTest.php, line 192

Class

ArgumentDateTimeTest
Tests the Drupal\datetime\Plugin\views\filter\Date handler.

Namespace

Drupal\Tests\datetime\Kernel\Views

Code

public function testDatetimeArgumentFullDate() {
  $view = Views::getView('test_argument_datetime');

  // The 'embed_5' display has CCYYMMDD argument.
  $view
    ->setDisplay('embed_5');
  $this
    ->executeView($view, [
    '20001010',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[0]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
  $view
    ->setDisplay('embed_5');
  $this
    ->executeView($view, [
    '20020101',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[2]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
}