protected function FieldDateTest::assertRenderedDatesEqual in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/FieldDateTest.php \Drupal\views\Tests\Handler\FieldDateTest::assertRenderedDatesEqual()
Asserts properly formatted display against 'created' field in view.
Parameters
mixed $view: View to be tested.
array $map: Data map.
null $timezone: Optional timezone.
1 call to FieldDateTest::assertRenderedDatesEqual()
- FieldDateTest::testFieldDate in core/
modules/ views/ src/ Tests/ Handler/ FieldDateTest.php - Sets up functional test of the views date field.
File
- core/
modules/ views/ src/ Tests/ Handler/ FieldDateTest.php, line 156 - Contains \Drupal\views\Tests\Handler\FieldDateTest.
Class
- FieldDateTest
- Tests the core Drupal\views\Plugin\views\field\Date handler.
Namespace
Drupal\views\Tests\HandlerCode
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']
->advancedRender($view->result[0]);
$this
->assertEqual($expected_result, $actual_result, $message);
}
}