function ArgumentDateTimeTest::testDatetimeArgumentDay

Same name in other branches
  1. 9 core/modules/datetime/tests/src/Kernel/Views/ArgumentDateTimeTest.php \Drupal\Tests\datetime\Kernel\Views\ArgumentDateTimeTest::testDatetimeArgumentDay()
  2. 10 core/modules/datetime/tests/src/Kernel/Views/ArgumentDateTimeTest.php \Drupal\Tests\datetime\Kernel\Views\ArgumentDateTimeTest::testDatetimeArgumentDay()
  3. 11.x core/modules/datetime/tests/src/Kernel/Views/ArgumentDateTimeTest.php \Drupal\Tests\datetime\Kernel\Views\ArgumentDateTimeTest::testDatetimeArgumentDay()

Test day argument.

See also

\Drupal\datetime\Plugin\views\argument\DayDate

File

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

Class

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

Namespace

Drupal\Tests\datetime\Kernel\Views

Code

public function testDatetimeArgumentDay() {
    $view = Views::getView('test_argument_datetime');
    // The 'embed_2' display has the 'day' argument.
    $view->setDisplay('embed_2');
    $this->executeView($view, [
        '10',
    ]);
    $expected = [];
    $expected[] = [
        'nid' => $this->nodes[0]
            ->id(),
    ];
    $expected[] = [
        'nid' => $this->nodes[1]
            ->id(),
    ];
    $this->assertIdenticalResultset($view, $expected, $this->map);
    $view->destroy();
    $view->setDisplay('embed_2');
    $this->executeView($view, [
        '01',
    ]);
    $expected = [];
    $expected[] = [
        'nid' => $this->nodes[2]
            ->id(),
    ];
    $expected[] = [
        'nid' => $this->nodes[3]
            ->id(),
    ];
    $this->assertIdenticalResultset($view, $expected, $this->map);
    $view->destroy();
}

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