function FieldDateTest::assertRenderedFutureDatesEqual

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

Asserts properly formatted display against 'destroyed' field in view.

@internal

Parameters

\Drupal\views\ViewExecutable $view: View to be tested.

array $map: Data map.

1 call to FieldDateTest::assertRenderedFutureDatesEqual()
FieldDateTest::testFieldDate in core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php
Sets up functional test of the views date field.

File

core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php, line 183

Class

FieldDateTest
Tests the core Drupal\views\Plugin\views\field\Date handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function assertRenderedFutureDatesEqual(ViewExecutable $view, array $map) : void {
    foreach ($map as $format => $result) {
        $view->field['destroyed']->options['date_format'] = $format;
        $view_result = (string) $view->field['destroyed']
            ->advancedRender($view->result[0]);
        $this->assertEquals($result, strip_tags($view_result), "{$format} format matches.");
    }
}

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