public function ArgumentDateTimeTest::testDatetimeArgumentYear in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/datetime/src/Tests/Views/ArgumentDateTimeTest.php \Drupal\datetime\Tests\Views\ArgumentDateTimeTest::testDatetimeArgumentYear()
 
Test year argument.
See also
\Drupal\datetime\Plugin\views\argument\YearDate
File
- core/
modules/ datetime/ src/ Tests/ Views/ ArgumentDateTimeTest.php, line 50  - Contains \Drupal\datetime\Tests\Views\ArgumentDateTimeTest.
 
Class
- ArgumentDateTimeTest
 - Tests the Drupal\datetime\Plugin\views\filter\Date handler.
 
Namespace
Drupal\datetime\Tests\ViewsCode
public function testDatetimeArgumentYear() {
  $view = Views::getView('test_argument_datetime');
  // The 'default' display has the 'year' argument.
  $view
    ->setDisplay('default');
  $this
    ->executeView($view, [
    '2000',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[0]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
  $view
    ->setDisplay('default');
  $this
    ->executeView($view, [
    '2002',
  ]);
  $expected = [];
  $expected[] = [
    'nid' => $this->nodes[2]
      ->id(),
  ];
  $this
    ->assertIdenticalResultset($view, $expected, $this->map);
  $view
    ->destroy();
}