You are here

protected function FieldDateTest::assertRenderedFutureDatesEqual in Drupal 9

Same name and namespace in other branches
  1. 8 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.

Parameters

mixed $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 182

Class

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

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function assertRenderedFutureDatesEqual($view, $map) {
  foreach ($map as $format => $result) {
    $view->field['destroyed']->options['date_format'] = $format;
    $view_result = $view->field['destroyed']
      ->advancedRender($view->result[0]);
    $t_args = [
      '%value' => $result,
      '%format' => $format,
      '%actual' => $view_result,
    ];
    $message = t('Value %value in %format matches %actual', $t_args);
    $this
      ->assertEquals($result, $view_result, $message);
  }
}