1.20.x views_handler_field_date.test protected ViewsHandlerFieldDateTest::assertRenderedDatesEqual($view, $map, $timezone = NULL)

File

modules/views/tests/handlers/views_handler_field_date.test, line 63
Definition of ViewsHandlerFieldDateTest.

Class

ViewsHandlerFieldDateTest
Tests the core views_handler_field_date handler.

Code

protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) {
  foreach ($map as $date_format => $expected_result) {
    $view->field['created']->options['date_format'] = $date_format;
    $t_args = array(
      '%value' => $expected_result,
      '%format' => $date_format,
    );
    if (isset($timezone)) {
      $t_args['%timezone'] = $timezone;
      $message = t('Value %value in %format format for timezone %timezone matches.', $t_args);
      $view->field['created']->options['timezone'] = $timezone;
    }
    else {
      $message = t('Value %value in %format format matches.', $t_args);
    }
    $actual_result = $view->field['created']->advanced_render($view->result[0]);
    $this->assertEqual($expected_result, $actual_result, $message);
  }
}