You are here

public function ArgumentDateTimeTest::testDatetimeArgumentYearMonth in Drupal 8

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

Test year_month CCYYMM argument.

File

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

Class

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

Namespace

Drupal\Tests\datetime\Kernel\Views

Code

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

  // The 'embed_6' display has CCYYMM argument.
  $view
    ->setDisplay('embed_6');
  $this
    ->executeView($view, [
    '200010',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[0]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
  $view
    ->setDisplay('embed_6');
  $this
    ->executeView($view, [
    '200201',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[2]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
}