1 views_handler_field_math.test | protected ViewsHandlerFieldMath::testMathFloatRender() |
Test rendering of float values in "Global: Math expression" fields.
File
- core/
modules/ views/ tests/ handlers/ views_handler_field_math.test, line 54 - Definition of ViewsHandlerFieldMath.
Class
- ViewsHandlerFieldMath
- Tests the core views_handler_field_math handler.
Code
protected function testMathFloatRender() {
// We need one dummy node of any type for our node based views query.
$type = $this->backdropCreateContentType();
$this->backdropCreateNode(array(
'type' => $type->type,
));
$view = views_get_view('floatval_check');
$this->executeView($view);
$result = $view->result[0];
foreach ($view->field as $name => $view_field) {
if ($name == 'nid') {
continue;
}
// In the view we set the label value to the raw input value (floats), to
// compare rendered output here.
$label = $view->field[$name]->label();
$render = $view->field[$name]->advanced_render($result);
$this->assertIdentical($label, $render, format_string('Expected rendered output to be %label, got %render', array(
'%label' => $label,
'%render' => $render,
)));
}
}