function FieldTimeIntervalTest::testFieldTimeInterval

Same name in other branches
  1. 10 core/modules/views/tests/src/Kernel/Handler/FieldTimeIntervalTest.php \Drupal\Tests\views\Kernel\Handler\FieldTimeIntervalTest::testFieldTimeInterval()
  2. 11.x core/modules/views/tests/src/Kernel/Handler/FieldTimeIntervalTest.php \Drupal\Tests\views\Kernel\Handler\FieldTimeIntervalTest::testFieldTimeInterval()

Test TimeInterval handler.

File

core/modules/views/tests/src/Functional/Handler/FieldTimeIntervalTest.php, line 57

Class

FieldTimeIntervalTest
Tests the time interval handler.

Namespace

Drupal\Tests\views\Functional\Handler

Code

public function testFieldTimeInterval() {
    $view = Views::getView('test_view');
    $view->setDisplay();
    $this->executeView($view);
    foreach ($view->result as $delta => $row) {
        [
            $value,
            $formatted_value,
            $granularity,
        ] = $this->ages[$delta];
        $view->field['age']->options['granularity'] = $granularity;
        $this->assertEquals($formatted_value, $view->field['age']
            ->advancedRender($row));
    }
}

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