public function HandlerFieldFieldTest::_testFormatterSimpleFieldRender in Views (for Drupal 7) 8.3
Tests that fields with formatters runs as expected.
1 call to HandlerFieldFieldTest::_testFormatterSimpleFieldRender()
- HandlerFieldFieldTest::testFieldRender in lib/
Drupal/ views/ Tests/ Field/ HandlerFieldFieldTest.php
File
- lib/
Drupal/ views/ Tests/ Field/ HandlerFieldFieldTest.php, line 101 - Definition of Drupal\views\Test\Field\HandlerFieldFieldTest.
Class
- HandlerFieldFieldTest
- Tests the field_field handler. @TODO Check a entity-type with bundles Check a entity-type without bundles Check locale:disabled, locale:enabled and locale:enabled with another language Check revisions
Namespace
Drupal\views\Tests\FieldCode
public function _testFormatterSimpleFieldRender() {
$view = $this
->getView();
$view->displayHandlers['default']->options['fields'][$this->fields[0]['field_name']]['type'] = 'text_trimmed';
$view->displayHandlers['default']->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);
}
}