function viewsHandlerFieldFieldTest::_testFormatterSimpleFieldRender

Tests that fields with formatters runs as expected.

1 call to viewsHandlerFieldFieldTest::_testFormatterSimpleFieldRender()
viewsHandlerFieldFieldTest::testFieldRender in tests/field/views_fieldapi.test

File

tests/field/views_fieldapi.test, line 370

Class

viewsHandlerFieldFieldTest
Tests the field_field handler.

Code

public function _testFormatterSimpleFieldRender() {
    $view = $this->getFieldView();
    $view->display['default']->display_options['fields'][$this->fields[0]['field_name']]['type'] = 'text_trimmed';
    $view->display['default']->display_options['fields'][$this->fields[0]['field_name']]['settings'] = array(
        'trim_length' => 3,
    );
    $this->executeView($view);
    // Take sure that the formatter works as expected.
    // @todo actually there should be a specific formatter.
    for ($i = 0; $i < 2; $i++) {
        $rendered_field = $view->style_plugin
            ->get_field($i, $this->fields[0]['field_name']);
        $this->assertEqual(strlen($rendered_field), 3);
    }
}