You are here

public function ArgumentDateTimeTest::testDatetimeArgumentAll in Drupal 10

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

Tests year, month, and day arguments combined.

File

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

Class

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

Namespace

Drupal\Tests\datetime\Kernel\Views

Code

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

  // The 'embed_3' display has year, month, and day arguments.
  $view
    ->setDisplay('embed_3');
  $this
    ->executeView($view, [
    '2000',
    '10',
    '10',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[0]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
  $view
    ->setDisplay('embed_3');
  $this
    ->executeView($view, [
    '2002',
    '01',
    '01',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[2]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
}