public function FieldCustomTest::testFieldCustom in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/FieldCustomTest.php \Drupal\views\Tests\Handler\FieldCustomTest::testFieldCustom()
Ensure that custom fields work and doesn't escape unnecessary markup.
File
- core/
modules/ views/ src/ Tests/ Handler/ FieldCustomTest.php, line 42 - Contains \Drupal\views\Tests\Handler\FieldCustomTest.
Class
- FieldCustomTest
- Tests the core Drupal\views\Plugin\views\field\Custom handler.
Namespace
Drupal\views\Tests\HandlerCode
public function testFieldCustom() {
$view = Views::getView('test_view');
$view
->setDisplay();
// Alter the text of the field to a random string.
$random = '<div>' . $this
->randomMachineName() . '</div>';
$view->displayHandlers
->get('default')
->overrideOption('fields', array(
'name' => array(
'id' => 'name',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
'alter' => array(
'text' => $random,
),
),
));
$this
->executeView($view);
$this
->assertEqual($random, $view->style_plugin
->getField(0, 'name'));
}