function ArgumentDateTest::testMonthHandler

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentDateTest::testMonthHandler()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentDateTest::testMonthHandler()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/ArgumentDateTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentDateTest::testMonthHandler()

Tests the Month handler.

See also

\Drupal\node\Plugin\views\argument\CreatedMonth

File

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

Class

ArgumentDateTest
Tests the core date argument handlers.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.