You are here

public function HandlerFieldFieldTest::_testInaccessibleFieldRender in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php \Drupal\field\Tests\Views\HandlerFieldFieldTest::_testInaccessibleFieldRender()
1 call to HandlerFieldFieldTest::_testInaccessibleFieldRender()
HandlerFieldFieldTest::testFieldRender in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php

File

core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php, line 153
Contains \Drupal\field\Tests\Views\HandlerFieldFieldTest.

Class

HandlerFieldFieldTest
Tests the field itself of the Field integration.

Namespace

Drupal\field\Tests\Views

Code

public function _testInaccessibleFieldRender() {
  $view = Views::getView('test_view_fieldapi');
  $this
    ->prepareView($view);
  $this
    ->executeView($view);

  // Check that the field handler for the hidden field is correctly removed
  // from the display.
  // @see https://www.drupal.org/node/2382931
  $this
    ->assertFalse(array_key_exists('field_no_view_access', $view->field));

  // Check that the access-denied field is not visible.
  for ($i = 0; $i < 3; $i++) {
    $field_name = $this->fieldStorages[6]
      ->getName();
    $rendered_field = $view->style_plugin
      ->getField($i, $field_name);
    $this
      ->assertFalse($rendered_field, 'Hidden field not rendered');
  }
}